@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260418064017 → 0.8.1-dev.20260418101320

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
@@ -1202,42 +1202,37 @@ var DateView = (props) => {
1202
1202
  if (format === "relative") {
1203
1203
  return getRelativeTime(dateString);
1204
1204
  }
1205
+ const now = /* @__PURE__ */ new Date();
1206
+ const offsetMinutes = now.getTimezoneOffset();
1207
+ const offsetMilliseconds = offsetMinutes * 60 * 1e3;
1208
+ const valDate = dateString.includes("Z") ? new Date(dateString) : /* @__PURE__ */ new Date(dateString + "Z");
1209
+ const localDate = new Date(valDate.getTime() - offsetMilliseconds);
1205
1210
  if (props.controlType === "date") {
1206
- const datePart = dateString.split("T")[0];
1207
- const [year, month, day] = datePart.split("-");
1208
- const safeDate = new Date(Number(year), Number(month) - 1, Number(day));
1209
1211
  return new Intl.DateTimeFormat("en", {
1210
1212
  day: "2-digit",
1211
1213
  month: "short",
1212
1214
  year: "numeric"
1213
- }).format(safeDate);
1215
+ }).format(localDate);
1214
1216
  }
1215
- const parsedDate = new Date(
1216
- dateString.includes("Z") ? dateString : dateString + "Z"
1217
- );
1218
- switch (props.controlType) {
1219
- case "time":
1220
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
1221
- userTimeZone
1222
- )} (${getTimePeriod(parsedDate)})`;
1223
- default:
1224
- return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1225
- timeZone: userTimeZone,
1226
- day: "2-digit",
1227
- month: "short",
1228
- year: "numeric",
1229
- hour: "2-digit",
1230
- minute: "2-digit"
1231
- }).format(parsedDate) : new Intl.DateTimeFormat("en", {
1232
- timeZone: userTimeZone,
1233
- day: "2-digit",
1234
- month: "short",
1235
- year: "numeric",
1236
- hour: "2-digit",
1237
- minute: "2-digit",
1238
- second: "2-digit"
1239
- }).format(parsedDate);
1217
+ if (props.controlType === "time") {
1218
+ return `${formatTime(localDate)} ${getTimeZoneAbbreviation(
1219
+ userTimeZone
1220
+ )} (${getTimePeriod(localDate)})`;
1240
1221
  }
1222
+ return localDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1223
+ day: "2-digit",
1224
+ month: "short",
1225
+ year: "numeric",
1226
+ hour: "2-digit",
1227
+ minute: "2-digit"
1228
+ }).format(localDate) : new Intl.DateTimeFormat("en", {
1229
+ day: "2-digit",
1230
+ month: "short",
1231
+ year: "numeric",
1232
+ hour: "2-digit",
1233
+ minute: "2-digit",
1234
+ second: "2-digit"
1235
+ }).format(localDate);
1241
1236
  };
1242
1237
  let localDateTime = "";
1243
1238
  let timeZoneAbbreviation = "";
package/dist/index.mjs CHANGED
@@ -214,42 +214,37 @@ var DateView = (props) => {
214
214
  if (format === "relative") {
215
215
  return getRelativeTime(dateString);
216
216
  }
217
+ const now = /* @__PURE__ */ new Date();
218
+ const offsetMinutes = now.getTimezoneOffset();
219
+ const offsetMilliseconds = offsetMinutes * 60 * 1e3;
220
+ const valDate = dateString.includes("Z") ? new Date(dateString) : /* @__PURE__ */ new Date(dateString + "Z");
221
+ const localDate = new Date(valDate.getTime() - offsetMilliseconds);
217
222
  if (props.controlType === "date") {
218
- const datePart = dateString.split("T")[0];
219
- const [year, month, day] = datePart.split("-");
220
- const safeDate = new Date(Number(year), Number(month) - 1, Number(day));
221
223
  return new Intl.DateTimeFormat("en", {
222
224
  day: "2-digit",
223
225
  month: "short",
224
226
  year: "numeric"
225
- }).format(safeDate);
227
+ }).format(localDate);
226
228
  }
227
- const parsedDate = new Date(
228
- dateString.includes("Z") ? dateString : dateString + "Z"
229
- );
230
- switch (props.controlType) {
231
- case "time":
232
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
233
- userTimeZone
234
- )} (${getTimePeriod(parsedDate)})`;
235
- default:
236
- return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
237
- timeZone: userTimeZone,
238
- day: "2-digit",
239
- month: "short",
240
- year: "numeric",
241
- hour: "2-digit",
242
- minute: "2-digit"
243
- }).format(parsedDate) : new Intl.DateTimeFormat("en", {
244
- timeZone: userTimeZone,
245
- day: "2-digit",
246
- month: "short",
247
- year: "numeric",
248
- hour: "2-digit",
249
- minute: "2-digit",
250
- second: "2-digit"
251
- }).format(parsedDate);
229
+ if (props.controlType === "time") {
230
+ return `${formatTime(localDate)} ${getTimeZoneAbbreviation(
231
+ userTimeZone
232
+ )} (${getTimePeriod(localDate)})`;
252
233
  }
234
+ return localDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
235
+ day: "2-digit",
236
+ month: "short",
237
+ year: "numeric",
238
+ hour: "2-digit",
239
+ minute: "2-digit"
240
+ }).format(localDate) : new Intl.DateTimeFormat("en", {
241
+ day: "2-digit",
242
+ month: "short",
243
+ year: "numeric",
244
+ hour: "2-digit",
245
+ minute: "2-digit",
246
+ second: "2-digit"
247
+ }).format(localDate);
253
248
  };
254
249
  let localDateTime = "";
255
250
  let timeZoneAbbreviation = "";
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.20260418064017",
3
+ "version": "0.8.1-dev.20260418101320",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",