mirror of
https://github.com/status-im/burnchart.git
synced 2025-01-31 21:06:01 +00:00
handle daylight saving
This commit is contained in:
parent
58801fa38c
commit
eba859bcbc
@ -14,7 +14,8 @@ module.exports =
|
||||
|
||||
days = []
|
||||
do add = (i = 0) ->
|
||||
days.push c = new Date(year, month - 1, day + i).toJSON().match(reg.datetime)[1]
|
||||
# Use 12 hours to handle daylight saving.
|
||||
days.push c = new Date(year, month - 1, day + i, 12).toJSON().match(reg.datetime)[1]
|
||||
add(i + 1) unless c is b
|
||||
|
||||
|
||||
cb null, days
|
@ -15,6 +15,8 @@ tests =
|
||||
[ '2012-12-12T00:00:00Z', '2013-01-05T00:00:00Z' ]
|
||||
'range on the same day':
|
||||
[ '2012-12-12T00:00:00Z', '2013-12-12T00:00:00Z' ]
|
||||
'daylight saving':
|
||||
[ '2013-05-09T09:04:53Z', '2013-05-12T09:04:53Z' ]
|
||||
|
||||
for key, value of tests then do (key, value) ->
|
||||
exports[key] = (done) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user