@domorium/validator 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
2
2
 
3
3
  All notable changes to `@domorium/validator` are documented here.
4
4
 
5
+ ## 1.7.0 - 2026-08-13
6
+
7
+ - **A date payload offers completions, and they depend on where the cursor is.**
8
+ Typing one got no help at all, in a format where the help is most needed. The
9
+ start of a value offers the calendars, the modifiers and the months; after a
10
+ number, the months it could still take and the epoch it could already be;
11
+ after `BET`'s first date, `AND`; after `FROM`'s, `TO`. An exact date is offered
12
+ months alone, since its grammar admits no calendar and no epoch.
13
+ - **The months offered are the ones the calendar in force actually has.**
14
+ a cursor after `HEBREW 1` offers `TSH` through `ELL`, one after `FRENCH_R`
15
+ offers `VEND` through `COMP`, and the twelve a user knows by heart are not among them. This is the
16
+ case the feature is for.
17
+ - GEDCOM 7 only. 5.5.1 keeps its months in a regular expression and its
18
+ `calendar` section is empty, so there is nothing there to offer from.
19
+
20
+ - **A date naming a day the calendar does not have is reported.** `31 FEB 1900`,
21
+ `31 APR 1880`, `0 JAN` and `99 JAN` were all accepted: the grammar gives a day
22
+ as one or two digits, and nothing looked at the month it belongs to. Each now
23
+ carries `VAL014` saying which day was named and how many the month has. So does
24
+ `29 FEB 1900` — a year divisible by 100 and not by 400 has no 29th — while
25
+ `29 FEB 2000` and `29 FEB 2024` stay quiet.
26
+ - The check is separate from the grammar and reported with a code of its own,
27
+ because `31 FEB 1900` _is_ a date: telling its author it is not one would say
28
+ the wrong thing about a value they can see is a date.
29
+ - **A Julian date is judged by the Julian rule**, which keeps every fourth year
30
+ leap with no exception for centuries, so `JULIAN 29 FEB 1700` is accepted where
31
+ the same day in the Gregorian calendar is not. `HEBREW` and `FRENCH_R` have
32
+ months of their own and are not judged by anyone else's calendar. Both dialects
33
+ are covered, including 5.5.1's `@#DJULIAN@` escape.
34
+ - A phrase is removed before a value is read as a date, so
35
+ `INT 1900 (born 31 FEB by the old reckoning)` reports nothing.
36
+
5
37
  ## 1.6.0 - 2026-08-12
6
38
 
7
39
  - **A fragment can be checked without being told it is not a file.** Text that is
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Which part of a date the cursor is in. A flat list would be worse than
3
+ * nothing here: the months worth offering depend on the calendar named a few
4
+ * tokens earlier, and the keywords depend on what the value opened with.
5
+ */
6
+ export type DateGrammar = "value" | "period" | "exact";
7
+ export interface DateSlot {
8
+ /** A calendar may be named here. */
9
+ calendars: boolean;
10
+ /** Whose months may be named here, or null where none may. */
11
+ months: string | null;
12
+ /** Whose epochs may be named here, or null where none may. */
13
+ epochs: string | null;
14
+ /** Bare words the grammar allows here. */
15
+ keywords: string[];
16
+ }
17
+ export declare function dateSlot(typed: string, grammar: DateGrammar): DateSlot;