@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "3.0.7-alpha.6",
3
+ "version": "3.0.7-alpha.7",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
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 = momentDate.format("z");
44
- if (/GMT[+-]\d+/.test(tzAbbr)) {
45
- const tz = momentDate.tz() || orgTimezone || "UTC";
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}`;