andrewplummer / Sugar

A Javascript library for working with native objects.
https://sugarjs.com/
MIT License
4.54k stars 305 forks source link

Daylight Savings Time on iOS not supported #470

Closed shaunetobias closed 9 years ago

shaunetobias commented 10 years ago

To generate an array of all times in 15 minute increments, I placed the following in a loop:

thisTime = (15).minutesAfter(thisTime);

When the loop got to Sunday morning (when my local clocks go back), the array would then display:

01:00, 01:15, 01:30, 01:45, 01:00, 01:15, 01:30, 01:45, 01:00, 01:15, 01:30, 01:45, 01:00, 01:15, 01:30, 01:45, 01:00, 01:15, 01:30, 01:45, 01:00, 01:15, 01:30, 01:45, (until end of loop).

All times are in UTC.

I changed to plain ol' JS and it fixed it:

thisTime = Date.create(thisTime.getTime() + 15 * 60000);

returns the correct times:

01:00, 01:15, 01:30, 01:45, 01:00, 01:15, 01:30, 01:45, 02:00, 02:15, 02:30, 02:45, 03:00, 03:15, 03:30, 03:45 (until end of loop)

andrewplummer commented 9 years ago

Really sorry about how long this has taken to address. To be clear, are you saying that in the Sugar method it went into an infinite loop?

andrewplummer commented 9 years ago

This is almost certainly a duplicate of #468 so I'm going to close this one out and will have a look! Thank you.