calendarDate
const calendarDate: RegExp = /^(\d{4}|\+\d{6}|-(?!0{6})\d{6})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])\[(!)?u-ca=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]$/;RegExp matching a calendar-annotated PlainDate string in the RFC 9557 form Temporal writes and reads: the ISO 8601 date, then one [u-ca=<id>] calendar annotation. The digits are always ISO; the annotation only names the calendar the date is presented in (RFC 9557 §3.3). This is exactly Temporal.PlainDate#toString() for a non-ISO calendar.
Examples
Section titled “Examples”import { calendarDate } from "@northguild/gmt";calendarDate.test("2024-10-03[u-ca=hebrew]") // truecalendarDate.test("+275760-09-13[u-ca=hebrew]") // truecalendarDate.test("2024-10-03[!u-ca=japanese]") // true (critical flag)calendarDate.test("0006-10-03[u-ca=japanese;era=reiwa]") // false (not RFC 9557)calendarDate.test("279517-10-11[u-ca=hebrew]") // false (a six-digit year needs a sign)calendarDate.test("2024-03-15") // false (no calendar annotation)