Add a bit more flexibility to jquery time input values
i.e. for when the user hand-keys a value
This commit is contained in:
parent
9f14d01c22
commit
42b97d1e1a
|
@ -37,4 +37,11 @@ class JQueryTime(colander.Time):
|
||||||
def deserialize(self, node, cstruct):
|
def deserialize(self, node, cstruct):
|
||||||
if not cstruct:
|
if not cstruct:
|
||||||
return colander.null
|
return colander.null
|
||||||
return colander.timeparse(cstruct, '%I:%M %p')
|
try:
|
||||||
|
return colander.timeparse(cstruct, '%I:%M %p')
|
||||||
|
except ValueError:
|
||||||
|
try:
|
||||||
|
return colander.timeparse(cstruct, '%I:%M%p')
|
||||||
|
except:
|
||||||
|
# re-try first format, for "better" error
|
||||||
|
return colander.timeparse(cstruct, '%I:%M %p')
|
||||||
|
|
Loading…
Reference in a new issue