@capillarytech/cap-ui-utils 3.0.7-alpha.6 → 3.0.7-alpha.7
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/package.json +1 -1
- package/utils/timezone.js +5 -3
package/package.json
CHANGED
package/utils/timezone.js
CHANGED
|
@@ -40,10 +40,12 @@ export const formatDateWithTimezone = (date, orgTZ = false) => {
|
|
|
40
40
|
if (!momentDate.isValid()) return "-";
|
|
41
41
|
|
|
42
42
|
// Get strict timezone abbreviation (no offsets like GMT+05:30)
|
|
43
|
-
let tzAbbr
|
|
44
|
-
if (
|
|
45
|
-
const tz = momentDate.tz() || orgTimezone
|
|
43
|
+
let tzAbbr;
|
|
44
|
+
if (momentDate.isValid()) {
|
|
45
|
+
const tz = momentDate.tz() || orgTimezone;
|
|
46
46
|
tzAbbr = moment.tz.zone(tz)?.abbr(momentDate.valueOf()) || "UTC";
|
|
47
|
+
} else {
|
|
48
|
+
tzAbbr = "UTC"; // fallback
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
return `${momentDate.format(DATE_FORMAT)} ${tzAbbr}`;
|