Hello, Sounded promising, but fails. Changed web2py/gluon/sqlhtml.py with v2.9.11 and with trunk version. Even fails if a use literal translated string as in:
iso_format = {'_data-w2p_datetime_format' : '%d/%m/%Y %H:%M:%S'} Code to reproduce: def dt(): from datetime import datetime T.force('es') db = DAL('sqlite:memory:') db.define_table('event', Field('name', 'string'), Field('day_and_time', 'datetime'), ) db.event.insert(name='Birthday1', day_and_time=datetime(1999, 1, 1, 0, 0 , 0)) db.event.insert(name='Birthday2', day_and_time=datetime(2000, 1, 1, 0, 0 , 0)) grid = SQLFORM.grid(db.event) return dict(grid=grid) It fails with: event.day_and_time >= "01/01/2000 00:00:00" It works with: event.day_and_time >= "2000-01-01 00:00:00" Regards. El martes, 23 de diciembre de 2014 08:35:28 UTC+1, Paolo Valleri escribió: > > Hi, > the issue is here > https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L1830 > can you try to replace that line with the following: > iso_format = {'_data-w2p_datetime_format' : T('%Y-%m-%d %H:%M:%S')} > > Paolo > > On Monday, December 22, 2014 11:02:00 PM UTC+1, mcamel wrote: >> >> Hi all, >> >> I use frequently spanish localization, so dates are formated like >> day/month/year. >> >> Everything works fine if this is located at languages/es.py: '%Y-%m-%d >> %H:%M:%S': '%d/%m/%Y %H:%M:%S'. Represents, validators and widgets, follow >> this rule. >> >> But if you try to filter a grid by datetime with spanish format, it >> doesn't work. You have to especify the query with Iso format, which is >> annoying. >> Even more, if you use 'w2p_timezone_plugin' to use local time zone, >> datetime filter also ignores it, so you have to specify UTC timezone. >> >> So, datetime filters at grids only works with ISO format and UTC timezone. >> >> Anyone knows a trick to make this work?. >> >> Thanks! >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.