New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime ignores date formatting string #248

bartaelterman opened this Issue Jul 25, 2015 · 1 comment


None yet
2 participants

bartaelterman commented Jul 25, 2015

The documentation for the marshmallow.fields.DateTime says:

    * format (str) – Either "rfc" (for RFC822), "iso" (for ISO8601), or a date format string. If None, defaults to “iso”.

But the part or a date format string is not true. I would've expected this to accept date formatting strings as defined in the time module, however, if the format parameter is a date formatting string, it is ignored and the parsing is done using dateutil (I noticed this here in the source code.

It looks like the documentation is not consistent with the code here. I think it would be very valuable if you could indeed provide a date formatting string and that marshmallow will use it with (time.strptime]( to parse it instead of letting dateutil do a guess about the format.

I am willing to edit this in the source code, but I would like to discuss the desired behaviour first.



This comment has been minimized.


sloria commented Jul 27, 2015

I agree; if a string other than 'rfc' or 'iso' is passed as the format argument, it should be assumed to be a date format, even if dateutil is installed.

I would welcome a PR for this.

@sloria sloria closed this in e8b08ba Aug 25, 2015

sloria added a commit that referenced this issue Aug 25, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment