The Challenges of Scheduling Tweets in DST Timezones

With the change-over on Sunday to daylight savings time, a bug reared its head in TweetLater.

Tweets that were entered into the system before Sunday and that were scheduled to be published after the DST change, were suddenly one hour off the originally intended scheduled time.

Figuring out the correct scheduling time may sound easy, but in actual fact it is not. Different timezones have different change-over rules, and some timezones don’t observe DST.

Try this on for size and see if you understand it.

If the timezone that the user selected observes Daylight Savings Time, then when storing a tweet in the system, you must check if you are currently in DST and whether the scheduled time of the tweet is also in DST, because if the scheduled time is into the next Standard Time then you must adjust the scheduled time so that it will publish one hour later than the time the user selected but if you are currently in Standard Time and the scheduled time of the tweet is in the next DST then you must adjust the scheduled time so that it will publish one hour earlier than the time the user selected, however, when the user views the tweet in the list of tweets or edits the tweet they still must see the original time they selected when they added the tweet, so you have to adjust the scheduled time in reverse to the above when you display the tweet’s scheduled time, and oh by the way, you must also adjust the display of the scheduled times in the same manner for tweets that were published in the previous DST or Standard Time period depending on whether you are currently in a DST or Standard Time period, and if the user’s timezone does not observer DST then you must not do the above to her tweets at all.

Here is what all of that means in plain English:

The issue is now fixed.