@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260418060421 → 0.8.1-dev.20260418062449

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/dist/index.js CHANGED
@@ -1155,7 +1155,9 @@ var DateView = (props) => {
1155
1155
  };
1156
1156
  const getRelativeTime = (dateString) => {
1157
1157
  const now = /* @__PURE__ */ new Date();
1158
- const date = /* @__PURE__ */ new Date(dateString + "Z");
1158
+ const date = new Date(
1159
+ dateString.includes("Z") ? dateString : dateString + "Z"
1160
+ );
1159
1161
  const diffMs = now.getTime() - date.getTime();
1160
1162
  const diffSec = Math.floor(diffMs / 1e3);
1161
1163
  const diffMin = Math.floor(diffSec / 60);
@@ -1180,29 +1182,35 @@ var DateView = (props) => {
1180
1182
  return new Date(valDate.getTime() - offsetMilliseconds);
1181
1183
  };
1182
1184
  const parseAndFormatDate = (dateString, format) => {
1183
- const parsedDate = getLocalDate(dateString);
1185
+ const parsedDate = new Date(
1186
+ dateString.includes("Z") ? dateString : dateString + "Z"
1187
+ );
1188
+ const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1184
1189
  if (format === "relative") {
1185
1190
  return getRelativeTime(dateString);
1186
1191
  }
1187
1192
  switch (props.controlType) {
1188
1193
  case "date":
1189
1194
  return new Intl.DateTimeFormat("en", {
1195
+ timeZone: userTimeZone,
1190
1196
  day: "2-digit",
1191
1197
  month: "short",
1192
1198
  year: "numeric"
1193
1199
  }).format(parsedDate);
1194
1200
  case "time":
1195
1201
  return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
1196
- Intl.DateTimeFormat().resolvedOptions().timeZone
1202
+ userTimeZone
1197
1203
  )} (${getTimePeriod(parsedDate)})`;
1198
1204
  default:
1199
1205
  return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1206
+ timeZone: userTimeZone,
1200
1207
  day: "2-digit",
1201
1208
  month: "short",
1202
1209
  year: "numeric",
1203
1210
  hour: "2-digit",
1204
1211
  minute: "2-digit"
1205
1212
  }).format(parsedDate) : new Intl.DateTimeFormat("en", {
1213
+ timeZone: userTimeZone,
1206
1214
  day: "2-digit",
1207
1215
  month: "short",
1208
1216
  year: "numeric",
@@ -1213,7 +1221,17 @@ var DateView = (props) => {
1213
1221
  }
1214
1222
  };
1215
1223
  const formatTime = (date) => {
1216
- return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", { hour: "2-digit", minute: "2-digit" }).format(date) : new Intl.DateTimeFormat("en", { hour: "2-digit", minute: "2-digit", second: "2-digit" }).format(date);
1224
+ const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1225
+ return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1226
+ timeZone: userTimeZone,
1227
+ hour: "2-digit",
1228
+ minute: "2-digit"
1229
+ }).format(date) : new Intl.DateTimeFormat("en", {
1230
+ timeZone: userTimeZone,
1231
+ hour: "2-digit",
1232
+ minute: "2-digit",
1233
+ second: "2-digit"
1234
+ }).format(date);
1217
1235
  };
1218
1236
  const getTimePeriod = (date) => {
1219
1237
  const hours = date.getHours();
package/dist/index.mjs CHANGED
@@ -167,7 +167,9 @@ var DateView = (props) => {
167
167
  };
168
168
  const getRelativeTime = (dateString) => {
169
169
  const now = /* @__PURE__ */ new Date();
170
- const date = /* @__PURE__ */ new Date(dateString + "Z");
170
+ const date = new Date(
171
+ dateString.includes("Z") ? dateString : dateString + "Z"
172
+ );
171
173
  const diffMs = now.getTime() - date.getTime();
172
174
  const diffSec = Math.floor(diffMs / 1e3);
173
175
  const diffMin = Math.floor(diffSec / 60);
@@ -192,29 +194,35 @@ var DateView = (props) => {
192
194
  return new Date(valDate.getTime() - offsetMilliseconds);
193
195
  };
194
196
  const parseAndFormatDate = (dateString, format) => {
195
- const parsedDate = getLocalDate(dateString);
197
+ const parsedDate = new Date(
198
+ dateString.includes("Z") ? dateString : dateString + "Z"
199
+ );
200
+ const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
196
201
  if (format === "relative") {
197
202
  return getRelativeTime(dateString);
198
203
  }
199
204
  switch (props.controlType) {
200
205
  case "date":
201
206
  return new Intl.DateTimeFormat("en", {
207
+ timeZone: userTimeZone,
202
208
  day: "2-digit",
203
209
  month: "short",
204
210
  year: "numeric"
205
211
  }).format(parsedDate);
206
212
  case "time":
207
213
  return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
208
- Intl.DateTimeFormat().resolvedOptions().timeZone
214
+ userTimeZone
209
215
  )} (${getTimePeriod(parsedDate)})`;
210
216
  default:
211
217
  return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
218
+ timeZone: userTimeZone,
212
219
  day: "2-digit",
213
220
  month: "short",
214
221
  year: "numeric",
215
222
  hour: "2-digit",
216
223
  minute: "2-digit"
217
224
  }).format(parsedDate) : new Intl.DateTimeFormat("en", {
225
+ timeZone: userTimeZone,
218
226
  day: "2-digit",
219
227
  month: "short",
220
228
  year: "numeric",
@@ -225,7 +233,17 @@ var DateView = (props) => {
225
233
  }
226
234
  };
227
235
  const formatTime = (date) => {
228
- return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", { hour: "2-digit", minute: "2-digit" }).format(date) : new Intl.DateTimeFormat("en", { hour: "2-digit", minute: "2-digit", second: "2-digit" }).format(date);
236
+ const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
237
+ return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
238
+ timeZone: userTimeZone,
239
+ hour: "2-digit",
240
+ minute: "2-digit"
241
+ }).format(date) : new Intl.DateTimeFormat("en", {
242
+ timeZone: userTimeZone,
243
+ hour: "2-digit",
244
+ minute: "2-digit",
245
+ second: "2-digit"
246
+ }).format(date);
229
247
  };
230
248
  const getTimePeriod = (date) => {
231
249
  const hours = date.getHours();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls-dev",
3
- "version": "0.8.1-dev.20260418060421",
3
+ "version": "0.8.1-dev.20260418062449",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",