Live data from Hacker News

Scheduling morning emails with Python and Celery

cucumbertown.com

11–19 of 19 posts

Re: Scheduling morning emails with Python and Celery

#11
post #6
post #4

This doesn't handle daylight saving time.

It does take care of DST: http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp

Better Reference (W3 Schools sucks: http://w3fools.com/):

https://developer.mozilla.org/en-US/docs/JavaScript/Referenc...

Re: Scheduling morning emails with Python and Celery

#12
post #6
post #4

This doesn't handle daylight saving time.

It does take care of DST: http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp

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.

Re: Scheduling morning emails with Python and Celery

#13
post #6

Earlier quoted context omitted.

It does take care of DST: http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp

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.

Re: Scheduling morning emails with Python and Celery

#14
Isn't the ScheduleTime class doing redundant work? Why bother keeping a dictionary, dealing with ints and strings when you can directly use strftime/strptime?

Except for the friday/fri thing, which, to be honest, I don't see the point of. I'd rather have uniformity in my code.

Re: Scheduling morning emails with Python and Celery

#15

Isn't the ScheduleTime class doing redundant work? Why bother keeping a dictionary, dealing with ints and strings when you can directly use strftime/strptime? Except for the friday/fri thing, which, to be honest, I don't see the point of. I'd rather have uniformity in my code.

Agree. Its not the most useful class.

Re: Scheduling morning emails with Python and Celery

#19
post #13

Earlier quoted context omitted.

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…

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.
Post reply on HN