I am not sure I complete get the implication of your answer. Are you
saying I have two options?
One: leave the model as it is:
db.define_table('event',
SQLField(...),
SQLField('datum', type='date', default='', notnull=True,),
SQLField('einddatum', type='date'),
SQLField('...),
migrate=False)
db.event.datum.requires=[IS_DATE('%d-%m-%Y'), IS_NOT_EMPTY()]
db.event.einddatum.requires=IS_DATE('%d-%m-%Y')
And in web2py_ajax.html adjust the following lines of code:
try {$("input.date").focus( function() {Calendar.setup({
inputField:this.id, ifFormat:"{{=T('%Y-%m-%d')}}",
showsTime:false
}); }); } catch(e) {};
try { $("input.datetime").focus( function() {Calendar.setup({
inputField:this.id, ifFormat:"{{=T('%Y-%m-%d %H:%M:%S')}}",
showsTime: true,timeFormat: "24"
}); }); } catch(e) {};
To read like:
try {$("input.date").focus( function() {Calendar.setup({
inputField:this.id, ifFormat:"{{=T('%d-%m-%Y')}}",
showsTime:false
}); }); } catch(e) {};
try { $("input.datetime").focus( function() {Calendar.setup({
inputField:this.id, ifFormat:"{{=T('%d-%m-%Y %H:%M:%S')}}",
showsTime: true,timeFormat: "24"
}); }); } catch(e) {};
Two: change the validators to read like:
db.event.datum.requires=[IS_DATE(str(T('%Y-%m-%d'))), IS_NOT_EMPTY()]
db.event.einddatum.requires=IS_DATE(str(T('%Y-%m-%d')))
and create a language file en-du.py. Will this in all cases take care
of the date being presented in the correct format?
What are the consequences of these two options for these line of code:
fromdate=request.vars.datum
todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
(request.vars.dagen))
Here todate should be calculated as: fromdate + days = todate
It worked when I used the YYYY-MM-DD format, however, now that I
changed the format to DD-MM-YYYY I expect it to break.
Kind regards,
Annet
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---