You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1d82ef6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .changeset/20534-import-date-cell-iso-real-day.md
+26-12Lines changed: 26 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
'@objectstack/rest': minor
3
3
---
4
4
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)
6
6
7
7
Clause-②: no (narrowing)
8
8
@@ -16,6 +16,10 @@ trimming:
16
16
business timezone, as before);
17
17
-`YYYY-MM-DD HH:MM[:SS[.fraction]]` with no offset, which is what the export
18
18
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;
19
23
- for a `time` field, also a bare `HH:MM` / `HH:MM:SS`.
20
24
21
25
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" /
24
28
which read it in the SERVER PROCESS's timezone and month-first, and rolled an
25
29
impossible day into the next month, so the import reported success and stored
26
30
a different value. For each shape, change the cell FROM the refused spelling
27
-
TO the ISO one:
31
+
TO an admitted one:
28
32
29
33
-**An impossible day.** FROM `2026-02-30`, `2026-02-29`, `2026-04-31` in any
30
34
spelling (a `datetime``2026-02-30` was stored as 2 March, and so was a
@@ -37,23 +41,33 @@ TO the ISO one:
37
41
`2026-08-07`. No timezone and no field order is guessed. Converting a
38
42
spreadsheet column to ISO (in Excel, the cell format `yyyy-mm-dd` or
39
43
`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.
46
51
-**A zone after a space, or lower-case `t` / `z`.** FROM
47
52
`2026-07-15 10:00Z`, `2026-07-15 10:00:00+08:00`, `2026-07-15t10:00:00z` TO
`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
+
57
71
**The year keeps four digits.** A `date` cell for a year from 0001 to 0999
58
72
(`0500-01-01`) used to leave the reader as `500-01-01`, which the write door
59
73
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.
72
86
**If you are refused.** The row's result carries `code: 'invalid_date'` and
73
87
quotes the cell, so the file can be corrected and re-imported.
74
88
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