Great post. I just finished my own implementation of the same controls, and I followed the same logic with one exception.
You say that your server knows a user's time zone. How? A user may travel and access your site from a different computer set to a different time zone. So, what happens when a user has time zone A stored in his profile, but he accesses your site from time zone B?
I decided to implement a proper TimeZone object on the client, which allows me to show dates and times (and to take dates and times) in any time zone a user chooses, regardless on the browser time zone.
I'd appreciate your thoughts.
Andrei
In our application, TimeZone is a user preference. Regardless of where they are in the world and how their computer and browser are configured, our application renders using their preference.Basically, "time zone A" as you call it is authoritative and "time zone B" is ignored. Our date and time controls, called UTCDateBox and UTCTimeBox, are written to operate independently of the browser's TimeZone.For example, suppose a user is editing an event taking place at 7pm Sept 10th EDT (about 30 minutes from now as I type this). If their user preference TimeZone is EDT, the server will tell the controls to render "7:00 PM" and "Sept 10th, 2012". If the user preference TimeZone is JST, the server will tell the controls to render "8:00 AM" and "Sept 11, 2012". The controls themselves don't care about TimeZone. When the values come back to the server, the proper Java Date will be created that corresponds to the proper time using the values from the controls with the user's preferred TimeZone.
Basically, this is the same idea, but adjustments are made on the client side. I like your approach, though.