PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | resources/js/lib/dateFormat.ts +10 -2 3.0.11 → 3.0.16 View file →
@@ -65,10 +65,18 @@
65 65 * one day early. Building the Date from its parts pins it to the intended
66 66 * calendar day regardless of timezone. Datetime strings (with a time part) and
67 67 * Date objects are parsed/returned as before.
68 68 */
69 -export function toDateValue(value: string | Date): Date {
70 - if (typeof value !== "string") return value;
69 +export function toDateValue(value: string | Date | null | undefined): Date {
70 + // Never hand back a non-Date. This previously returned `value` unchanged for
71 + // anything that wasn't a string, so a missing date came back as `undefined`
72 + // and the caller's `.toLocaleDateString()` threw — taking the whole admin
73 + // dashboard down with it via the error boundary. An Invalid Date keeps every
74 + // caller's date maths working (comparisons are simply false) and lets the
75 + // display helpers fall back to "-".
76 + if (value === null || value === undefined) return new Date(NaN);
77 + if (value instanceof Date) return value;
78 + if (typeof value !== "string") return new Date(NaN);
71 79 const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
72 80 if (dateOnly) {
73 81 return new Date(
74 82 Number(dateOnly[1]),