Parsing time-strings in Javascript
So, I have this web server that parses an XML-file with a certain
'time-period'.
The time-period is presented as follows (I can't change this):
00:05:00 00:09:15 01:13:15 in an HH:MM:SS format.
I want to do an _.filter() select on all objects with a date between for
instance 00:00:00 and 00:10:00, and then a filter with all objects between
00:10:00 and 00:20:00.
EDIT (clarification): With the time periods are 'times watched'. Let's say
there are 50 entries of the time period, ranging from 00:00:00 to 1:30:00,
but I want to make a new list that contains
The time period
The average 'times watched' in that time period.
This means I need some way to say: 'Select all time periods between zero
minutes and 10 minutes. Give me a list of those. Compute the mean'.
For that, I would need to have some possibility to do arithmetic
operations, seeing I would like to
Compare dates
Add 10 minutes on each iteration
However, the Javascript Date object doesn't seem to handle 'just times'
that well, neither does the moment.js library. How would I go for this?
No comments:
Post a Comment