Skip to content

Commit 1d82ef6

Browse files
hotlongclaude
andcommitted
chore(changeset): year-first dates stay admitted; name their newly refused edges (#20534)
Claude-Session: https://claude.ai/code/session_local_1d2a197c-c20e-4e90-9be8-413d4d432289 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 279ca42 commit 1d82ef6

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

‎.changeset/20534-import-date-cell-iso-real-day.md‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'@objectstack/rest': minor
33
---
44

5-
fix(rest): `POST /api/v1/data/:object/import` reads a `date`, `datetime` or `time` cell only in ISO 8601 or the export's own `YYYY-MM-DD HH:mm:ss`, on a calendar day that exists, and keeps a `date`'s year at four digits (#20534)
5+
fix(rest): `POST /api/v1/data/:object/import` reads a `date`, `datetime` or `time` cell only in ISO 8601, the export's own `YYYY-MM-DD HH:mm:ss` or a year-first date (`2026/7/15`), on a calendar day that exists, and keeps a `date`'s year at four digits (#20534)
66

77
Clause-②: no (narrowing)
88

@@ -16,6 +16,10 @@ trimming:
1616
business timezone, as before);
1717
- `YYYY-MM-DD HH:MM[:SS[.fraction]]` with no offset, which is what the export
1818
writes for a `datetime` cell;
19+
- a year-first date, `YYYY/M/D` or `YYYY-M-D` (a four-digit year, a one- or
20+
two-digit month and day, the same separator twice), optionally followed by
21+
one space and `H:MM` or `H:MM:SS` with no offset, read exactly as the
22+
export shape is;
1923
- for a `time` field, also a bare `HH:MM` / `HH:MM:SS`.
2024

2125
The day must exist. Every other cell is that row's `invalid_date` error, with
@@ -24,7 +28,7 @@ the importer's existing sentence ("is not a valid date" / "datetime" /
2428
which read it in the SERVER PROCESS's timezone and month-first, and rolled an
2529
impossible day into the next month, so the import reported success and stored
2630
a different value. For each shape, change the cell FROM the refused spelling
27-
TO the ISO one:
31+
TO an admitted one:
2832

2933
- **An impossible day.** FROM `2026-02-30`, `2026-02-29`, `2026-04-31` in any
3034
spelling (a `datetime` `2026-02-30` was stored as 2 March, and so was a
@@ -37,23 +41,33 @@ TO the ISO one:
3741
`2026-08-07`. No timezone and no field order is guessed. Converting a
3842
spreadsheet column to ISO (in Excel, the cell format `yyyy-mm-dd` or
3943
`yyyy-mm-dd hh:mm:ss`) before export is the fix.
40-
- **A year-first spelling that is not ISO.** FROM `2026/7/15`, `2026/07/15`,
41-
`2026-7-15`, `2026/07/15 10:00` or a one-digit hour (`2026-07-15 9:00`) TO
42-
the zero-padded, dash-separated `2026-07-15`, `2026-07-15 10:00`,
43-
`2026-07-15 09:00`. These used to import as the day they denote; they are
44-
refused with the rest because the reader accepts ISO 8601 and the export's
45-
own shape and nothing else.
44+
- **A year-first date outside its one form.** FROM a mixed separator
45+
(`2026/7-15`) TO `2026/7/15` or `2026-07-15`. FROM a `T` or a zone on the
46+
year-first form (`2026/7/15T9:00`, `2026/7/15 9:00Z`) TO `2026/7/15 9:00`
47+
(a wall clock in the business timezone) or the ISO `2026-07-15T09:00:00Z`.
48+
FROM a fraction of a second (`2026/07/15 10:00:00.123`) TO
49+
`2026-07-15 10:00:00.123`. A two-digit year (`26/7/15`) is refused, as it
50+
was.
4651
- **A zone after a space, or lower-case `t` / `z`.** FROM
4752
`2026-07-15 10:00Z`, `2026-07-15 10:00:00+08:00`, `2026-07-15t10:00:00z` TO
4853
`2026-07-15T10:00Z`, `2026-07-15T10:00:00+08:00`, `2026-07-15T10:00:00Z`,
4954
the spellings the create and update doors take.
50-
- **A zone-naive `24:00`.** FROM `2026-07-15 24:00` (read in the server's
51-
zone) TO `2026-07-16 00:00`. `2026-07-15T24:00:00Z`, which names its
52-
instant, reads as before.
55+
- **A zone-naive `24:00`.** FROM `2026-07-15 24:00` or `2026/7/15 24:00` (read
56+
in the server's zone) TO `2026-07-16 00:00` or `2026/7/16 0:00`.
57+
`2026-07-15T24:00:00Z`, which names its instant, reads as before.
5358
- **A number, reduced or expanded forms.** FROM a JSON number such as `2026`
5459
or an Excel serial, `2026`, `2026-07`, `+002026-07-15` TO `2026-01-01`,
5560
`2026-07-01`, `2026-07-15`.
5661

62+
**Kept: year-first dates.** `2026/7/15`, `2026/07/15`, `2026-7-15`,
63+
`2026/7/15 9:00` and `2026/08/01 06:00:00`, Excel's default short date in
64+
zh-CN and ja-JP, stay admitted. They are now held to the same rules as every
65+
other cell: the day must exist (`2026/2/30` is refused, never rolled into
66+
March), the hour runs 0 to 23, and the day is stored in its padded ISO form
67+
(`2026/7/15` is stored as `2026-07-15`). A year-first date with no clock
68+
given to a `time` field reads as `00:00:00`, as an ISO day does; it used to
69+
read the server's zone (`04:00:00` on a New York server).
70+
5771
**The year keeps four digits.** A `date` cell for a year from 0001 to 0999
5872
(`0500-01-01`) used to leave the reader as `500-01-01`, which the write door
5973
refuses, so the import refused a day the create door takes. It is stored as
@@ -72,4 +86,4 @@ before. The same narrowing applies to the exported `coerceRow` helper.
7286
**If you are refused.** The row's result carries `code: 'invalid_date'` and
7387
quotes the cell, so the file can be corrected and re-imported.
7488

75-
<!-- adr-0087: not-required (no-migration-prescription) Nothing authorable is removed, renamed or reshaped: no spec key, no export, no stored row. The import door's cell reader accepts fewer spellings of a date inside an imported file, which is data, not metadata, so `objectstack migrate meta` has nothing to reach. The row's invalid_date error quotes the refused cell, and the repair is to write the date in ISO 8601. -->
89+
<!-- adr-0087: not-required (no-migration-prescription) Nothing authorable is removed, renamed or reshaped: no spec key, no export, no stored row. The import door's cell reader accepts fewer spellings of a date inside an imported file, which is data, not metadata, so `objectstack migrate meta` has nothing to reach. The row's invalid_date error quotes the refused cell, and the repair is to write the date in ISO 8601 or as a year-first date. -->

0 commit comments

Comments
 (0)