From bfff356dd36f7d14d35d8a854cd314e60cf25efa Mon Sep 17 00:00:00 2001 From: Stephan Groß Date: Tue, 26 Feb 2013 11:09:54 +0100 Subject: Add better date / datetime validation (pull 2) addition to #631 with update to master + timefield support --- rest_framework/utils/dates.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rest_framework/utils/dates.py (limited to 'rest_framework/utils') diff --git a/rest_framework/utils/dates.py b/rest_framework/utils/dates.py new file mode 100644 index 00000000..f094f72d --- /dev/null +++ b/rest_framework/utils/dates.py @@ -0,0 +1,14 @@ +def get_readable_date_format(date_format): + mapping = [("%Y", "YYYY"), + ("%y", "YY"), + ("%m", "MM"), + ("%b", "[Jan through Dec]"), + ("%B", "[January through December]"), + ("%d", "DD"), + ("%H", "HH"), + ("%M", "MM"), + ("%S", "SS"), + ("%f", "uuuuuu")] + for k, v in mapping: + date_format = date_format.replace(k, v) + return date_format \ No newline at end of file -- cgit v1.2.3