Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This doesn't handle daylight saving time.



Wouldn't it be a better idea to store the timezone and then account for the DST at the server side? https://bitbucket.org/pellepim/jstimezonedetect

getTimezoneOffset() gives you the offset with the DST accounted and will be a different time when DST is off.


When it comes to scheduling emails, what we want is user's to get emails at a specific time as exactly as possible. For this all we need is the UTC timezone offset including DST, which javascript gives us. The jstimezonedetect script is a good one if we wan't to know the real timezone. Problem here is we wouldn't know how often this script could remain updated. Any change in DST will have to be provided by the script which if it doesn't there will be in-accuracies. Not to mention the trouble of keeping the script updated. But in general, the script is indeed awesome.


I believe that the point is: If you have the user's timezone, you can /know/ if they are in DST through modules such as pytz+datetime.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: