Menu

#5 DateToTextConverter

closed
nobody
None
5
2003-01-11
2002-12-31
Edmund
No

When using TextFields to accept and display dates, the
DateConverter and DateValidator functions convert
textual input to mx mx.DateTime instances. If you try
to redisplay these fields on error or as a static
field, the instances will display only as ISO formatted
date/time strings.

The patch attached is an additional converter you can
insert as the last item in a validator list to convert
the mx.DateTime instances back into a locale or
user-defined format so that users see something a bit
more familiar.

E.g.,

in a field definition, write:

TextField("myDateField", validators=[DateConverter(),
DateValidator(...),
DateToTextConverter(format="<strftime format string")])

The default value of DateToTextConverter's format
string is "%x", which is the locale appropriate date
string.

Discussion

  • Edmund

    Edmund - 2002-12-31

    DateToTextConverter function

     
  • Edmund

    Edmund - 2003-01-11
    • status: open --> closed
     

Log in to post a comment.