handle daylight saving

This commit is contained in:
Radek Stepan 2013-08-14 13:58:40 +01:00
parent 58801fa38c
commit eba859bcbc
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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) ->