@capillarytech/cap-ui-utils 3.0.9-alpha.4 → 3.0.9-alpha.5

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.9-alpha.4",
3
+ "version": "3.0.9-alpha.5",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/utils/timezone.js CHANGED
@@ -73,15 +73,18 @@ const getTimezoneFormattedDate = (date,orgTZ = false,serverTZ = false,customTZ =
73
73
  * @param {string|null} customTZ - Custom timezone override (e.g., "Asia/Kolkata").
74
74
  * @returns {string} Formatted date string with timezone abbreviation or '-'.
75
75
  */
76
- export const formatDateWithTimezone = (date, orgTZ = false, serverTZ = false, customTZ = null) => {
76
+ export const formatDateWithTimezone = (date, tzAbbr = true,orgTZ = false, serverTZ = false, customTZ = null) => {
77
77
  try {
78
78
  if (!date) return "-";
79
79
 
80
80
  const momentDate = getTimezoneFormattedDate(date,orgTZ,serverTZ,customTZ);
81
81
  if (!momentDate.isValid()) return "-";
82
-
83
- const tzAbbr = momentDate.format("z"); // e.g., IST, PST
84
- return `${momentDate.format(DATE_FORMAT)} ${tzAbbr}`;
82
+
83
+ if(tzAbbr) {
84
+ const tzAbbr = momentDate.format("z");
85
+ return `${momentDate.format(DATE_FORMAT)} ${tzAbbr}`;
86
+ }
87
+ return momentDate.format(DATE_FORMAT);
85
88
  } catch (error) {
86
89
  console.error(error);
87
90
  return "-";