UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

82 lines 3.84 kB
"use strict"; /* * AUTO-GENERATED FILE — DO NOT EDIT. * Source of truth: packages/style-rules/src/ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install). */ Object.defineProperty(exports, "__esModule", { value: true }); exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = void 0; /** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ const zod_1 = require("zod"); const date_utils_1 = require("./date-utils"); /** * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond * timestamp at evaluation time. Supported formats: * - RFC 9557 with IANA timezone: `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset * inferred from the named zone, DST-aware) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"` * (offset explicit) * - UTC or offset datetime: `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"` * - Plain datetime (treated as UTC): `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"` * - Date-only (treated as UTC midnight): `"2024-01-01"` */ exports.DatetimeLiteralSchema = zod_1.z.object({ datetime: zod_1.z.string().refine((s) => (0, date_utils_1.parseDateString)(s) !== null, { message: 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string', }), }); /** * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix * millisecond timestamp at evaluation time, interpreting the wall-clock time * in the browser's local timezone. * * Only plain date/datetime strings without timezone qualifiers are accepted: * - Plain datetime: `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"` * - Date-only (treated as local midnight): `"2024-01-01"` * * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`. */ exports.LocalDatetimeLiteralSchema = zod_1.z.object({ localdatetime: zod_1.z.string().refine((s) => (0, date_utils_1.parseLocalDateString)(s) !== null, { message: 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)', }), }); /** * An ISO 8601 time literal that resolves to milliseconds since UTC midnight * at evaluation time. Supported formats: * - Local time (treated as UTC): `"14:30:00"`, `"14:30:00.500"` * - UTC time: `"14:30:00Z"` — identical to local form * - Offset time (UTC-normalised): `"14:30:00+02:00"` → 45,000,000 ms (12:30 UTC) * * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a * time-of-day value has no calendar date so DST cannot be resolved. Use * `{ datetime }` literals for timezone-aware instants. * * Full datetime strings (containing `T`) are rejected. */ exports.TimeLiteralSchema = zod_1.z.object({ time: zod_1.z.string().refine((s) => (0, date_utils_1.parseTimeString)(s) !== null, { message: 'time must be a valid ISO 8601 time string (e.g. "14:30:00" or "14:30:00+02:00")', }), }); //# sourceMappingURL=literal-schemas.js.map