Hey alan ![]()
First of all, you need to get each value at a time, so we need to split this value to (hrs, mins and secs) using JavaScript 's method split() .
// Define a variable object with the necessary properties.
let value = { raw: '', hr: '', min: '', sec: '' };
// Split the value and save the array.
value.raw = $w('#timeInput').value.split(':');
// Store the splitted values
value.hr = Number(value.raw[0]);
value.min = Number(value.raw[1]);
value.sec = Number(value.raw[2]);
Now, the second part really depends on your scenario, if all you need is just the time regardless of the dates then store the values like this.
// Convert time to seconds.
let final_value = (value.hr*60*60) + (value.min*60) + value.sec;
Now you’ll have the time as seconds, that means when sorting, the less value (seconds) is earlier that, so when using ascending sorting the entries with less value (earlier) will come up first.
But, if you want to store dates too then it’s a different story.
Hope this helps~!
Ahmad