diff options
| author | Stephan Groß | 2013-02-26 11:09:54 +0100 |
|---|---|---|
| committer | Stephan Groß | 2013-03-01 16:48:20 +0100 |
| commit | 9157db5da0b5601793d1a9f24e9cb10670a82be2 (patch) | |
| tree | d0c323884c4b5efd05fc40893b25bb18c6cc572d /rest_framework/utils/dates.py | |
| parent | 282af6057f30b5af4665d687200ee1ebf82fcf00 (diff) | |
| download | django-rest-framework-9157db5da0b5601793d1a9f24e9cb10670a82be2.tar.bz2 | |
Add better date / datetime validation (pull 2)
addition to #631 with update to master + timefield support
Diffstat (limited to 'rest_framework/utils/dates.py')
| -rw-r--r-- | rest_framework/utils/dates.py | 14 |
1 files changed, 14 insertions, 0 deletions
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 |
