PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.17
Yatra – Travel Booking & Tour Operator Software v3.0.17
3.0.17 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 All 85 releases
← All changes | resources/js/pages/account/utils.ts +11 -14 3.0.5 → 3.0.17 View file →
@@ -2,8 +2,12 @@
2 2 import {
3 3 applyCurrencyPosition,
4 4 formatYatraMoney,
5 5 } from "../../lib/currency-display";
6 +import {
7 + formatDate as formatGlobalDate,
8 + parseDate,
9 +} from "../../lib/dateFormat";
6 10
7 11 function toBrowserLocaleTag(
8 12 locale: string | undefined | null,
9 13 ): string | undefined {
@@ -24,24 +28,17 @@
24 28 if (!value) {
25 29 return __("N/A", "yatra");
26 30 }
27 31
28 - try {
29 - const date = new Date(value);
30 -
31 - // Check if date is valid
32 - if (isNaN(date.getTime())) {
33 - return __("Invalid date", "yatra");
34 - }
35 -
36 - return date.toLocaleDateString(getAccountLocale(), {
37 - year: "numeric",
38 - month: "long",
39 - day: "numeric",
40 - });
41 - } catch (error) {
32 + // Render public account dates in the operator's configured global date
33 + // format (Settings → General) via the shared formatter — not a hardcoded
34 + // browser style. It also parses a date-only value (e.g. a booking's
35 + // travel_date) in LOCAL time, so it no longer rolls back a day in behind-UTC
36 + // timezones (Aug 1 → Jul 31).
37 + if (!parseDate(value)) {
42 38 return __("Invalid date", "yatra");
43 39 }
40 + return formatGlobalDate(value);
44 41 };
45 42
46 43 /** Leading Y-m-d from API datetime strings for stable range comparison. */
47 44 function extractYmd(value: string | undefined | null): string | null {