hello one and all,
below is a simple test code with 3 fields where the input field is really the test of the IS_DATETIME validator is tested. the default is commented out because I couldn't get it to compile and IS_DATETIME doesn't show the seconds as required in the format and instead PM/AM shows up even though %H should be in 24-hour format. so what is the format option to exclude the AM/PM altogether that lets the 24-hour format work it out.
and when you hit submit, all kinds of hellfire and damnation comes out of the exception but mainly focusing on "ValueError: time data '' does not match format '%Y-%m-%d %H:%M:%S'"".
so there you have it. Lucas
@action("datetime_test")
@action.uses("index.html", db, auth, session, T)
def datetime_test():
fields = [
Field("name", length=12, requires=IS_NOT_EMPTY(), default='name',),
Field('input', 'datetime', requires=IS_DATETIME(format=T('%Y-%m-%d %H:%M:%S'), error_message='must be YYYY-MM-DD HH:MM:SS!'),),# default=datetime.now(),),
Field('duration', 'integer', requires=IS_INT_IN_RANGE(1,1e6), default=200,),
]
frm = Form(fields)
return dict(message=frm)