{"id":14768,"library":"nr-date","title":"nr-date","description":"nr-date is a fast, regex-based Python library designed for parsing human-readable dates and ISO 8601 durations in pure Python. It provides functionality to handle various date and time formats and is known for its performance compared to some standard library alternatives. The library is currently at version 2.1.0 and receives periodic updates, with major releases occurring roughly every few years.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"N/A - A direct GitHub repository is not readily discoverable for this project.","tags":["date-parsing","regex","iso-8601","duration"],"install":[{"cmd":"pip install nr-date","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The package is installed as 'nr-date' but its core functionality is exposed via the 'nr.parsing.date' module.","wrong":"import nr_date","symbol":"ISO_8601","correct":"from nr.parsing.date import ISO_8601"},{"note":"The package is installed as 'nr-date' but its core functionality is exposed via the 'nr.parsing.date' module.","wrong":"import nr_date","symbol":"duration","correct":"from nr.parsing.date import duration"}],"quickstart":{"code":"from nr.parsing.date import ISO_8601, duration\n\n# Parse an ISO 8601 datetime string\ndatetime_obj = ISO_8601.parse('2021-04-21T10:13:00.124+0000')\nprint(f\"Parsed datetime: {datetime_obj}\")\n\n# Parse an ISO 8601 duration string\nduration_obj = duration.parse('P3Y6M4DT12H30M5S')\nprint(f\"Parsed duration: {duration_obj}\")","lang":"python","description":"Demonstrates parsing an ISO 8601 datetime string and an ISO 8601 duration string using the respective parsers from `nr.parsing.date`."},"warnings":[{"fix":"Always use `from nr.parsing.date import ISO_8601, duration` or similar specific imports.","message":"When installing `nr-date` via pip, the core functionalities for parsing dates and durations are typically found within the `nr.parsing.date` module, not directly under `nr_date`. Attempting `import nr_date` will likely result in a `ModuleNotFoundError`.","severity":"gotcha","affected_versions":"All known versions (1.0.0+)"},{"fix":"Familiarize yourself with the supported format options and ensure input data conforms closely to these patterns. Consider adding custom format strings for highly variable inputs.","message":"As a regex-based parser, `nr-date` can be sensitive to the exact formatting of input strings. While flexible, unexpected input variations (e.g., missing optional separators or components) might lead to `None` being returned or incorrect parsing if not explicitly handled by a custom regex format.","severity":"gotcha","affected_versions":"All known versions (1.0.0+)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement from `import nr_date` to `from nr.parsing.date import ISO_8601, duration` (or other specific components you need).","cause":"The package is installed as 'nr-date' on PyPI, but its internal Python module structure does not expose `nr_date` directly as a top-level module. The primary components are within `nr.parsing.date`.","error":"ModuleNotFoundError: No module named 'nr_date'"},{"fix":"Instead of `nr.parsing.date.parse('...')`, you should use `ISO_8601.parse('...')` or `duration.parse('...')` depending on what you intend to parse.","cause":"The `nr.parsing.date` module itself does not expose a global `parse` function. Instead, parsing is done through specific parser objects like `ISO_8601` or `duration` that are imported from the module.","error":"AttributeError: module 'nr.parsing.date' has no attribute 'parse'"}],"ecosystem":"pypi"}