Skip to content

Commit c37326b

Browse files
naughty-datetimes: 86 annotated datetime/timezone edge-case fixtures across 17 categories
Structured (fixtures/datetimes.json) + flat (fixtures/datetimes.txt) formats, build/validation tool, example loaders (py/js/sh), CI, CC0 license.
0 parents  commit c37326b

14 files changed

Lines changed: 1104 additions & 0 deletions

File tree

.github/workflows/validate.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: validate
2+
on:
3+
push:
4+
pull_request:
5+
jobs:
6+
validate:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5
11+
with:
12+
python-version: "3.x"
13+
- name: Validate JSON schema + .txt is in sync
14+
run: python3 tools/build.py --check
15+
- name: Sanity-check the example loaders
16+
run: |
17+
python3 examples/load.py > /dev/null
18+
node examples/load.js > /dev/null
19+
sh examples/grep-usage.sh > /dev/null

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__/
2+
*.pyc
3+
.DS_Store

CODE_OF_CONDUCT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Code of Conduct
2+
3+
This project adopts the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) v2.1.
4+
5+
In short: be respectful, assume good faith, and focus on the work. Harassment, discrimination, and personal attacks are not tolerated. Maintainers may remove, edit, or reject contributions and comments that violate these principles.
6+
7+
Report concerns by opening a confidential issue or contacting the maintainers via the repository's contact channels.

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Contributing to naughty-datetimes
2+
3+
Thanks for helping harden the world's datetime handling! Contributions are welcome and appreciated.
4+
5+
## The one rule: **accuracy**
6+
7+
Every fixture must be *correct* and teach a *real, distinct* failure mode. A wrong "edge case" is worse than none. If you're not sure a fact is right, cite a source in the PR (IANA tz database, ISO 8601 / RFC 3339, a language's spec, etc.).
8+
9+
## How to add a fixture
10+
11+
1. Edit **`fixtures/datetimes.json`** — add an object with all four keys:
12+
```json
13+
{
14+
"value": "the raw input string",
15+
"category": "one-of-the-existing-slugs",
16+
"why_it_breaks": "one clear sentence: the specific reason parsers/storage get it wrong",
17+
"expected_handling": "what a correct system should do with it"
18+
}
19+
```
20+
Use an existing `category` from `fixtures/categories.json`. Proposing a *new* category? Add it to `categories.json` with a one-line description in the same PR.
21+
2. Regenerate the flat list and validate:
22+
```bash
23+
python3 tools/build.py # rewrites fixtures/datetimes.txt from the JSON
24+
python3 tools/build.py --check # what CI runs; must pass
25+
```
26+
`build.py` uses only the Python standard library (no installs).
27+
3. Commit both `fixtures/datetimes.json` and `fixtures/datetimes.txt`, and open a PR.
28+
29+
## What makes a great fixture
30+
31+
- **New failure mode**, not a near-duplicate of an existing value.
32+
- **Precise annotation** — name the exact mechanism (overflow, ambiguity, non-existence, precision loss…).
33+
- **Real** — something that occurs in actual data or standards, not a contrived typo (typos live in `invalid-boundary`, and even those should be *common* mistakes).
34+
35+
## Sibling corpora
36+
37+
Ideas for `naughty-numbers`, `naughty-unicode`, or `naughty-filenames` are very welcome — open an issue to coordinate so they share this repo's layout.
38+
39+
## Code of conduct
40+
41+
By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).

LICENSE

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
Creative Commons Legal Code
2+
3+
CC0 1.0 Universal
4+
5+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12+
HEREUNDER.
13+
14+
Statement of Purpose
15+
16+
The laws of most jurisdictions throughout the world automatically confer
17+
exclusive Copyright and Related Rights (defined below) upon the creator
18+
and subsequent owner(s) (each and all, an "owner") of an original work of
19+
authorship and/or a database (each, a "Work").
20+
21+
Certain owners wish to permanently relinquish those rights to a Work for
22+
the purpose of contributing to a commons of creative, cultural and
23+
scientific works ("Commons") that the public can reliably and without fear
24+
of later claims of infringement build upon, modify, incorporate in other
25+
works, reuse and redistribute as freely as possible in any form whatsoever
26+
and for any purposes, including without limitation commercial purposes.
27+
These owners may contribute to the Commons to promote the ideal of a free
28+
culture and the further production of creative, cultural and scientific
29+
works, or to gain reputation or greater distribution for their Work in
30+
part through the use and efforts of others.
31+
32+
For these and/or other purposes and motivations, and without any
33+
expectation of additional consideration or compensation, the person
34+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35+
is an owner of Copyright and Related Rights in the Work, voluntarily
36+
elects to apply CC0 to the Work and publicly distribute the Work under its
37+
terms, with knowledge of his or her Copyright and Related Rights in the
38+
Work and the meaning and intended legal effect of CC0 on those rights.
39+
40+
1. Copyright and Related Rights. A Work made available under CC0 may be
41+
protected by copyright and related or neighboring rights ("Copyright and
42+
Related Rights"). Copyright and Related Rights include, but are not limited
43+
to, the following:
44+
45+
i. the right to reproduce, adapt, distribute, perform, display,
46+
communicate, and translate a Work;
47+
ii. moral rights retained by the original author(s) and/or performer(s);
48+
iii. publicity and privacy rights pertaining to a person's image or
49+
likeness depicted in a Work;
50+
iv. rights protecting against unfair competition in regards to a Work,
51+
subject to the limitations in paragraph 4(a), below;
52+
v. rights protecting the extraction, dissemination, use and reuse of data
53+
in a Work;
54+
vi. database rights (such as those arising under Directive 96/9/EC of the
55+
European Parliament and of the Council of 11 March 1996 on the legal
56+
protection of databases, and under any national implementation
57+
thereof, including any amended or successor version of such
58+
directive); and
59+
vii. other similar, equivalent or corresponding rights throughout the
60+
world based on applicable law or treaty, and any national
61+
implementations thereof.
62+
63+
2. Waiver. To the greatest extent permitted by, but not in contravention
64+
of, applicable law, Affirmer hereby overtly, fully, permanently,
65+
irrevocably and unconditionally waives, abandons, and surrenders all of
66+
Affirmer's Copyright and Related Rights and associated claims and causes
67+
of action, whether now known or unknown (including existing as well as
68+
future claims and causes of action), in the Work (i) in all territories
69+
worldwide, (ii) for the maximum duration provided by applicable law or
70+
treaty (including future time extensions), (iii) in any current or future
71+
medium and for any number of copies, and (iv) for any purpose whatsoever,
72+
including without limitation commercial, advertising or promotional
73+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74+
member of the public at large and to the detriment of Affirmer's heirs and
75+
successors, fully intending that such Waiver shall not be subject to
76+
revocation, rescission, cancellation, termination, or any other legal or
77+
equitable action to disrupt the quiet enjoyment of the Work by the public
78+
as contemplated by Affirmer's express Statement of Purpose.
79+
80+
3. Public License Fallback. Should any part of the Waiver for any reason
81+
be judged legally invalid or ineffective under applicable law, then the
82+
Waiver shall be preserved to the maximum extent permitted taking into
83+
account Affirmer's express Statement of Purpose. In addition, to the
84+
extent the Waiver is so judged Affirmer hereby grants to each affected
85+
person a royalty-free, non transferable, non sublicensable, non exclusive,
86+
irrevocable and unconditional license to exercise Affirmer's Copyright and
87+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
88+
maximum duration provided by applicable law or treaty (including future
89+
time extensions), (iii) in any current or future medium and for any number
90+
of copies, and (iv) for any purpose whatsoever, including without
91+
limitation commercial, advertising or promotional purposes (the
92+
"License"). The License shall be deemed effective as of the date CC0 was
93+
applied by Affirmer to the Work. Should any part of the License for any
94+
reason be judged legally invalid or ineffective under applicable law, such
95+
partial invalidity or ineffectiveness shall not invalidate the remainder
96+
of the License, and in such case Affirmer hereby affirms that he or she
97+
will not (i) exercise any of his or her remaining Copyright and Related
98+
Rights in the Work or (ii) assert any associated claims and causes of
99+
action with respect to the Work, in either case contrary to Affirmer's
100+
express Statement of Purpose.
101+
102+
4. Limitations and Disclaimers.
103+
104+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
105+
surrendered, licensed or otherwise affected by this document.
106+
b. Affirmer offers the Work as-is and makes no representations or
107+
warranties of any kind concerning the Work, express, implied,
108+
statutory or otherwise, including without limitation warranties of
109+
title, merchantability, fitness for a particular purpose, non
110+
infringement, or the absence of latent or other defects, accuracy, or
111+
the present or absence of errors, whether or not discoverable, all to
112+
the greatest extent permissible under applicable law.
113+
c. Affirmer disclaims responsibility for clearing rights of other persons
114+
that may apply to the Work or any use thereof, including without
115+
limitation any person's Copyright and Related Rights in the Work.
116+
Further, Affirmer disclaims responsibility for obtaining any necessary
117+
consents, permissions or other rights required for any use of the
118+
Work.
119+
d. Affirmer understands and acknowledges that Creative Commons is not a
120+
party to this document and has no duty or obligation with respect to
121+
this CC0 or use of the Work.
122+
123+
For more information, please see
124+
<http://creativecommons.org/publicdomain/zero/1.0/>

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# naughty-datetimes
2+
3+
**A structured, categorized list of date & time values that break parsers, storage, and formatting — with an explanation for every one.**
4+
5+
[![License: CC0-1.0](https://img.shields.io/badge/license-CC0--1.0-brightgreen.svg)](LICENSE)
6+
![fixtures](https://img.shields.io/badge/fixtures-86-blue.svg)
7+
![categories](https://img.shields.io/badge/categories-17-blue.svg)
8+
![deps](https://img.shields.io/badge/dependencies-none-lightgrey.svg)
9+
10+
Almost every system that touches time gets some of these wrong: the DST hour that never happened, `Feb 29` in a non‑leap century, the 2038 overflow, `23:59:60`, `-00:00`, `24:00:00`, `+14:00`, `01/02/2024`, a five‑digit year, `0000-00-00`. This repo is a **ready‑to‑use test corpus** of those inputs — drop it into your test suite and find out.
11+
12+
Unlike a plain word list, **every fixture is annotated** with *why it breaks* and *what correct handling looks like*, and it's **organized by category** so you can target exactly the failure modes you care about.
13+
14+
```jsonc
15+
// one entry from fixtures/datetimes.json
16+
{
17+
"value": "2024-03-10T02:30:00 America/New_York",
18+
"category": "dst-gap",
19+
"why_it_breaks": "US spring-forward: clocks jump 02:00->03:00 (EST->EDT), so 02:30 local never existed on this date.",
20+
"expected_handling": "Reject as non-existent, or shift per an explicit gap policy (e.g. forward to 03:30). Never assume it is a valid local instant."
21+
}
22+
```
23+
24+
## Why this exists
25+
26+
The genre pioneer, [**big-list-of-naughty-strings**](https://github.com/minimaxir/big-list-of-naughty-strings) (blns), proved how useful a shared corpus of hostile inputs is — but it's a single flat list of *strings*, and datetimes are a distinct, deep failure domain with their own logic (calendars, timezones, offsets, leap rules). Curated *falsehoods* about time are catalogued beautifully by [**awesome-falsehood**](https://github.com/kdeldycke/awesome-falsehood) — but as prose to read, not fixtures to run.
27+
28+
**naughty-datetimes complements both:** it turns the well‑known time falsehoods into a machine‑readable, categorized, annotated corpus you can actually execute against your parser. It is not a criticism of those projects — it stands on their shoulders. (See [Attribution](#attribution).)
29+
30+
## Install / use
31+
32+
No dependencies, nothing to build. Just take the files:
33+
34+
- **`fixtures/datetimes.json`** — the canonical dataset: an array of `{ value, category, why_it_breaks, expected_handling }`.
35+
- **`fixtures/datetimes.txt`** — the same `value`s, one per line, blns‑style, for zero‑friction fuzzing. *(One line is intentionally blank — that's the empty‑string fixture.)*
36+
- **`fixtures/categories.json`** — the category slugs and their descriptions.
37+
38+
```bash
39+
# grab just the raw values and pipe them into your CLI/parser
40+
curl -sL https://raw.githubusercontent.com/FoundagentTest/naughty-datetimes/main/fixtures/datetimes.txt \
41+
| while IFS= read -r v; do your-parser "$v"; done
42+
```
43+
44+
```python
45+
# Python: assert your parser rejects the ones it should
46+
import json
47+
fixtures = json.load(open("fixtures/datetimes.json"))
48+
for fx in fixtures:
49+
... # feed fx["value"] to the code under test; fx["expected_handling"] tells you what "correct" is
50+
```
51+
52+
```javascript
53+
// Node
54+
const fixtures = require("./fixtures/datetimes.json");
55+
for (const fx of fixtures) { /* test fx.value */ }
56+
```
57+
58+
Runnable versions live in [`examples/`](examples/) (`load.py`, `load.js`, `grep-usage.sh`).
59+
60+
## Categories
61+
62+
| Category | # | What it covers |
63+
| --- | --: | --- |
64+
| `dst-gap` | 3 | Local times that never happened (spring-forward gap). |
65+
| `dst-overlap` | 2 | Local times that happened twice (fall-back overlap) and are ambiguous. |
66+
| `dst-unusual` | 2 | Rare DST/political transitions: skipped calendar days, half-hour DST. |
67+
| `leap-year` | 5 | Feb 29, leap-year and century-year rules (÷4, ÷100, ÷400). |
68+
| `epoch-2038` | 6 | Unix epoch boundaries and 32-bit `time_t` overflow (the 2038 problem). |
69+
| `leap-second` | 3 | The 60th second (`23:59:60`) inserted at real leap seconds. |
70+
| `special-time` | 4 | `-00:00`, `24:00:00`, midnight vs end-of-day and other special clock values. |
71+
| `offset-extreme` | 8 | Real and out-of-range UTC offsets; half/quarter-hour and sub-minute offsets. |
72+
| `tz-abbreviation` | 4 | Ambiguous timezone abbreviations that map to multiple zones. |
73+
| `ambiguous-format` | 4 | Numeric dates whose field order (DD/MM vs MM/DD) is ambiguous. |
74+
| `non-iso-format` | 9 | Common non-ISO / locale / wire formats parsers are asked to accept. |
75+
| `fractional-seconds` | 5 | Sub-second precision, comma decimals, and over-long fractions. |
76+
| `week-ordinal-date` | 5 | ISO week dates (`YYYY-Www-D`) and ordinal dates (`YYYY-DDD`). |
77+
| `far-future-past` | 5 | Extreme years and language/library min/max date limits. |
78+
| `year-zero-bce` | 3 | Year 0, negative (BCE) years, astronomical-vs-historical numbering. |
79+
| `invalid-boundary` | 12 | Out-of-range components and values that only *look* like datetimes. |
80+
| `not-an-instant` | 6 | Well-formed ISO 8601 that is **not** a single instant (durations, intervals, partials). |
81+
82+
**86 fixtures across 17 categories.** Highlights: the DST gap/overlap hours (`America/New_York`, `Europe/Paris`, `Europe/London`), the day Samoa skipped (`2011-12-30`), `1900-02-29` vs `2000-02-29`, the signed and unsigned 32‑bit overflow instants, three real leap seconds, `+14:00` / `+13:45` / `+05:45` / `-00:44:30` offsets, `CST`/`IST`/`BST`/`EST` abbreviation clashes, ISO week `2020-W53` vs the invalid `2024-W53`, `+275760-09-13` (JS max date), `-0043-03-15` (44 BCE), and `0000-00-00` (MySQL zero‑date).
83+
84+
## Scope & honesty
85+
86+
- **Accuracy:** every entry was hand‑checked. Where facts depend on the tz database (DST rules, historical offsets like Monrovia's `-00:44:30`), they reflect widely‑documented values; corrections via issues/PRs are welcome.
87+
- **Not exhaustive:** time is bottomless. This is a strong, curated core, not every conceivable input. Additions that bring a *genuinely new failure mode* (with a correct annotation) are exactly what we want.
88+
- **`expected_handling` is guidance, not gospel:** the "right" behavior can depend on your domain (a logging system and a billing system disagree about `24:00:00`). The field states the *considered default*; adapt it.
89+
- **Stable by design:** these are facts about calendars and formats, so the dataset needs little upkeep — that's the point.
90+
91+
## Roadmap — sibling categories
92+
93+
`naughty-datetimes` is the first of a planned family of **naughty‑fixtures** corpora, each a clean parallel with the same layout (`fixtures/<name>.json` + `fixtures/<name>.txt` + `examples/` + this README shape):
94+
95+
- **`naughty-numbers`**`NaN`, `Infinity`, `-0`, `9007199254740993` (past `2^53`), `1e308`, `0x10`, `1_000`, `٤٢` (non‑ASCII digits), thousands‑separator locales, currency rounding traps.
96+
- **`naughty-unicode`** — combining‑character bombs, RTL/LTR overrides, zero‑width joiners, homoglyphs, normalization (NFC/NFD) mismatches, astral‑plane & emoji ZWJ sequences, `İ`/`ı` casing.
97+
- **`naughty-filenames`**`CON`/`NUL`, trailing dots/spaces, `../`, path‑length limits, case‑insensitive collisions, reserved characters, Unicode normalization on macOS.
98+
99+
Want one of these sooner? Open an issue — or see [CONTRIBUTING](CONTRIBUTING.md).
100+
101+
## Contributing
102+
103+
Add a fixture by editing **`fixtures/datetimes.json`**, then run `python3 tools/build.py` to regenerate the flat `.txt` and validate. CI checks that the two stay in sync. Full guidelines: [CONTRIBUTING.md](CONTRIBUTING.md).
104+
105+
## Attribution
106+
107+
This project exists because of the corpora that came before it, and aims to complement — never replace — them:
108+
109+
- [**minimaxir/big-list-of-naughty-strings**](https://github.com/minimaxir/big-list-of-naughty-strings) — the flat‑list format and the whole idea of a shared "naughty inputs" corpus. If you want *strings*, start there.
110+
- [**kdeldycke/awesome-falsehood**](https://github.com/kdeldycke/awesome-falsehood) — the definitive curated reading list of "falsehoods programmers believe," including the time articles that informed many of these entries.
111+
112+
Individual time facts draw on long‑standing community knowledge (the IANA tz database, ISO 8601 / RFC 3339, and the classic "falsehoods programmers believe about time" writings).
113+
114+
## License
115+
116+
[**CC0‑1.0**](LICENSE) — public domain dedication. Use these fixtures anywhere, in any project, no attribution required (though a link back is always appreciated).

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
This repository ships **static test data** (strings) and a tiny, dependency-free Python build script. It has no runtime, no network access, and no execution of the fixture values.
4+
5+
The fixtures deliberately contain hostile/edge-case inputs. That is their purpose: use them to *test* your software in a controlled environment. They are inert data here.
6+
7+
Found an inaccuracy in a fixture, or a problem in `tools/build.py`? Please open a regular issue or pull request. If you believe you've found something genuinely sensitive, open an issue asking for a private contact channel and we'll follow up.

examples/grep-usage.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env sh
2+
# Zero-dependency usage of the flat fixture list. Run: sh examples/grep-usage.sh
3+
TXT="$(dirname "$0")/../fixtures/datetimes.txt"
4+
5+
echo "Total fixtures (incl. one intentional blank line = the empty-string case):"
6+
wc -l < "$TXT"
7+
8+
echo
9+
echo "All the +HH:MM offset cases:"
10+
grep -E '\+[0-9]{2}:[0-9]{2}' "$TXT"
11+
12+
echo
13+
echo "Pipe every value into your CLI parser, one per line:"
14+
echo " while IFS= read -r line; do your-parser \"\$line\"; done < \"$TXT\""

0 commit comments

Comments
 (0)