Metadata-Version: 2.4
Name: datasette-sqlite-dateutil
Version: 0.1a0
Summary: Datasette plugin that loads the sqlite-dateutil SQLite extension
Author: Simon Willison
License-Expression: Apache-2.0
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/simonw/sqlite-dateutil
Project-URL: Issues, https://github.com/simonw/sqlite-dateutil/issues
Project-URL: Changelog, https://github.com/simonw/sqlite-dateutil/releases
Project-URL: CI, https://github.com/simonw/sqlite-dateutil/actions
Requires-Dist: datasette
Requires-Dist: sqlite-dateutil==0.1a0
Description-Content-Type: text/markdown

# datasette-sqlite-dateutil

Datasette plugin that loads the sqlite-dateutil SQLite extension. [sqlite-dateutil](https://github.com/simonw/sqlite-dateutil) is a C port of [python-dateutil](https://github.com/dateutil/dateutil)'s `parser.parse()`, about 38x faster than calling dateutil from Python.

## Installation

```bash
datasette install datasette-sqlite-dateutil
```

## Usage

Once installed, the functions are available in every SQL query, for example:

```sql
select dateutil_parse('Thu, 25 Sep 2003 10:49:41 -0300');
-- 2003-09-25T10:49:41-03:00
```

Each function returns an ISO 8601 string, or `NULL` where dateutil would raise an exception:

| SQL function | Python equivalent |
| --- | --- |
| `dateutil_parse(text)` | `parse(text).isoformat()` |
| `dateutil_parse_fuzzy(text)` | `parse(text, fuzzy=True).isoformat()` |
| `dateutil_parse_dayfirst(text)` | `parse(text, dayfirst=True).isoformat()` |
| `dateutil_parse_fuzzy_dayfirst(text)` | `parse(text, fuzzy=True, dayfirst=True).isoformat()` |

See the [sqlite-dateutil documentation](https://github.com/simonw/sqlite-dateutil) for details and the known differences from dateutil.
