Opened 5 days ago

Closed 5 days ago

Last modified 5 days ago

#35825 closed Cleanup/optimization (invalid)

Document None return type for dateparse functions

Reported by: Adam Johnson Owned by:
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This documentation section for functions in the dateparse utils module does not cover that the contained functions can return None when they fail to parse the given value (I think that applies to all of them - worth checking). Let’s add that documentation and some usage examples on the way. The examples would probably be best in Python console code blocks.

Change History (1)

comment:3 by Sarah Boyce, 5 days ago

Resolution: invalid
Status: newclosed

I think it does state it at the top, the 3rd bullet point?

The functions defined in this module share the following properties:

- They accept strings in ISO 8601 date/time formats (or some close
  alternatives) and return objects from the corresponding classes in Python's
  :mod:`datetime` module.
- They raise :exc:`ValueError` if their input is well formatted but isn't a
  valid date or time.
- They return ``None`` if it isn't well formatted at all.
- They accept up to picosecond resolution in input, but they truncate it to
  microseconds, since that's what Python supports.
Note: See TracTickets for help on using tickets.
Back to Top