Did the patch from Niphlod mentioned here go live? 
I see that now validators can take a pytz object specifying the timezone. 
However, I was not able to find where the information on how to get the 
browser timezone.  Is this a plugin?

Also, am I correct to assume that the validators always return the time in 
UTC? 
I agree that this would be the best approach (given that for some timezones 
+ DST settings, there is no one-to-one correspondence between UTC and 
localtime...). 

Many thanks, 

Luca

On Sunday, March 17, 2013 7:31:24 PM UTC-7, Massimo Di Pierro wrote:
>
> I was looking at code to detect the user timezone and store dates 
> consistently in UTC format.
> I made some changes in trunk to handle this. I could use some help testing.
>
> 1) In the header of your layout.html add:
>
>  {{if not session.timezone:}}
>   <script>
>     
> jQuery(function(){jQuery.post('{{=URL('default','set_timezone')}}',{timezone:(new
>  
> Date()).getTimezoneOffset()});});
>   </script>
> {{pass}}
>
> 2) in the default controller:
>
> def set_timezone():
>     session.timezone = int(request.vars.timezone)/60
>
> 3) Use the new timezone attribute of validators in trunk:
>
>    Field('birthday','datetime',requires = 
> IS_DATETIME(timezone=session.timezone)
>
> Does it work for you? Suggestions for improvement?
>
> Massimo
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to