I have a major patch from Niphlod that replace my naive implementation with 
one based on pytz. I agree this is the way to go. We have two open issues:
1) should be include pytz in web2py r make it a depencency
2) should we do the pytz import in web2py or should we pass pytz objects to 
validators (the pytz would be defined outside of web2py), tus giving the 
option of not using pytz.

On Thursday, 21 March 2013 05:28:09 UTC-5, mart wrote:
>
> hum... I use this and solves pretty much the bulk of the DLST issues that 
> were problematic for me.
>
> http://pytz.sourceforge.net  (its the Olsen TZ DB wrapped in python)
>
> I found it a little tricky at first, but once i got my head wrapped around 
> the different permutations of 
> dates (past, presents, different time zones, DLST, DT formats) i work 
> with, things cleared up pretty 
> quickly.
>
> Anyways, works for me.
>
> - Mart
>
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to