@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260427125546 → 0.8.1-dev.20260428094243

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
@@ -1296,6 +1296,7 @@ var timeZoneAbbreviations = {
1296
1296
  // src/components/controls/view/DateView.tsx
1297
1297
  var import_jsx_runtime2 = require("react/jsx-runtime");
1298
1298
  var DateView = (props) => {
1299
+ const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1299
1300
  const getTimeZoneAbbreviation = (timeZone) => {
1300
1301
  return timeZoneAbbreviations[timeZone] || timeZone;
1301
1302
  };
@@ -1314,7 +1315,8 @@ var DateView = (props) => {
1314
1315
  return new Intl.DateTimeFormat("en", {
1315
1316
  day: "2-digit",
1316
1317
  month: "short",
1317
- year: "numeric"
1318
+ year: "numeric",
1319
+ timeZone: userTimeZone
1318
1320
  }).format(date);
1319
1321
  };
1320
1322
  console.log("DateView props:", props);
@@ -1328,55 +1330,63 @@ var DateView = (props) => {
1328
1330
  return new Intl.DateTimeFormat("en", {
1329
1331
  day: "2-digit",
1330
1332
  month: "short",
1331
- year: "numeric"
1333
+ year: "numeric",
1334
+ timeZone: userTimeZone
1332
1335
  }).format(parsedDate);
1333
1336
  case "time":
1334
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(Intl.DateTimeFormat().resolvedOptions().timeZone)} (${getTimePeriod(parsedDate)})`;
1337
+ return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(userTimeZone)} (${getTimePeriod(parsedDate)})`;
1335
1338
  default:
1336
1339
  return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1337
1340
  day: "2-digit",
1338
1341
  month: "short",
1339
1342
  year: "numeric",
1340
1343
  hour: "2-digit",
1341
- minute: "2-digit"
1344
+ minute: "2-digit",
1345
+ timeZone: userTimeZone
1342
1346
  }).format(parsedDate) : new Intl.DateTimeFormat("en", {
1343
1347
  day: "2-digit",
1344
1348
  month: "short",
1345
1349
  year: "numeric",
1346
1350
  hour: "2-digit",
1347
1351
  minute: "2-digit",
1348
- second: "2-digit"
1352
+ second: "2-digit",
1353
+ timeZone: userTimeZone
1349
1354
  }).format(parsedDate);
1350
1355
  }
1351
1356
  };
1352
1357
  const formatTime = (date) => {
1353
1358
  return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1354
1359
  hour: "2-digit",
1355
- minute: "2-digit"
1360
+ minute: "2-digit",
1361
+ timeZone: userTimeZone
1356
1362
  }).format(date) : new Intl.DateTimeFormat("en", {
1357
1363
  hour: "2-digit",
1358
1364
  minute: "2-digit",
1359
- second: "2-digit"
1365
+ second: "2-digit",
1366
+ timeZone: userTimeZone
1360
1367
  }).format(date);
1361
1368
  };
1362
1369
  const getTimePeriod = (date) => {
1363
- const hours = date.getHours();
1364
- if (hours >= 5 && hours < 8) return "Early Morning";
1365
- if (hours >= 8 && hours < 12) return "Morning";
1366
- if (hours >= 12 && hours < 14) return "Noon";
1367
- if (hours >= 14 && hours < 17) return "Afternoon";
1368
- if (hours >= 17 && hours < 20) return "Evening";
1369
- if (hours >= 20 && hours < 22) return "Late Evening";
1370
- if (hours >= 22 || hours < 5) return "Night";
1371
- return "Late Night";
1370
+ const localHours = Number(
1371
+ new Intl.DateTimeFormat("en", {
1372
+ hour: "numeric",
1373
+ hour12: false,
1374
+ timeZone: userTimeZone
1375
+ }).format(date)
1376
+ );
1377
+ if (localHours >= 5 && localHours < 8) return "Early Morning";
1378
+ if (localHours >= 8 && localHours < 12) return "Morning";
1379
+ if (localHours >= 12 && localHours < 14) return "Noon";
1380
+ if (localHours >= 14 && localHours < 17) return "Afternoon";
1381
+ if (localHours >= 17 && localHours < 20) return "Evening";
1382
+ if (localHours >= 20 && localHours < 22) return "Late Evening";
1383
+ return "Night";
1372
1384
  };
1373
1385
  let localDateTime = "";
1374
1386
  let timeZoneAbbreviation = "";
1375
1387
  try {
1376
1388
  localDateTime = parseAndFormatDate(props.value, props.format);
1377
- timeZoneAbbreviation = getTimeZoneAbbreviation(
1378
- Intl.DateTimeFormat().resolvedOptions().timeZone
1379
- );
1389
+ timeZoneAbbreviation = getTimeZoneAbbreviation(userTimeZone);
1380
1390
  } catch (error) {
1381
1391
  console.error("Error parsing date:", props.value, error);
1382
1392
  }
package/dist/index.mjs CHANGED
@@ -164,6 +164,7 @@ var timeZoneAbbreviations = {
164
164
  // src/components/controls/view/DateView.tsx
165
165
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
166
166
  var DateView = (props) => {
167
+ const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
167
168
  const getTimeZoneAbbreviation = (timeZone) => {
168
169
  return timeZoneAbbreviations[timeZone] || timeZone;
169
170
  };
@@ -182,7 +183,8 @@ var DateView = (props) => {
182
183
  return new Intl.DateTimeFormat("en", {
183
184
  day: "2-digit",
184
185
  month: "short",
185
- year: "numeric"
186
+ year: "numeric",
187
+ timeZone: userTimeZone
186
188
  }).format(date);
187
189
  };
188
190
  console.log("DateView props:", props);
@@ -196,55 +198,63 @@ var DateView = (props) => {
196
198
  return new Intl.DateTimeFormat("en", {
197
199
  day: "2-digit",
198
200
  month: "short",
199
- year: "numeric"
201
+ year: "numeric",
202
+ timeZone: userTimeZone
200
203
  }).format(parsedDate);
201
204
  case "time":
202
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(Intl.DateTimeFormat().resolvedOptions().timeZone)} (${getTimePeriod(parsedDate)})`;
205
+ return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(userTimeZone)} (${getTimePeriod(parsedDate)})`;
203
206
  default:
204
207
  return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
205
208
  day: "2-digit",
206
209
  month: "short",
207
210
  year: "numeric",
208
211
  hour: "2-digit",
209
- minute: "2-digit"
212
+ minute: "2-digit",
213
+ timeZone: userTimeZone
210
214
  }).format(parsedDate) : new Intl.DateTimeFormat("en", {
211
215
  day: "2-digit",
212
216
  month: "short",
213
217
  year: "numeric",
214
218
  hour: "2-digit",
215
219
  minute: "2-digit",
216
- second: "2-digit"
220
+ second: "2-digit",
221
+ timeZone: userTimeZone
217
222
  }).format(parsedDate);
218
223
  }
219
224
  };
220
225
  const formatTime = (date) => {
221
226
  return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
222
227
  hour: "2-digit",
223
- minute: "2-digit"
228
+ minute: "2-digit",
229
+ timeZone: userTimeZone
224
230
  }).format(date) : new Intl.DateTimeFormat("en", {
225
231
  hour: "2-digit",
226
232
  minute: "2-digit",
227
- second: "2-digit"
233
+ second: "2-digit",
234
+ timeZone: userTimeZone
228
235
  }).format(date);
229
236
  };
230
237
  const getTimePeriod = (date) => {
231
- const hours = date.getHours();
232
- if (hours >= 5 && hours < 8) return "Early Morning";
233
- if (hours >= 8 && hours < 12) return "Morning";
234
- if (hours >= 12 && hours < 14) return "Noon";
235
- if (hours >= 14 && hours < 17) return "Afternoon";
236
- if (hours >= 17 && hours < 20) return "Evening";
237
- if (hours >= 20 && hours < 22) return "Late Evening";
238
- if (hours >= 22 || hours < 5) return "Night";
239
- return "Late Night";
238
+ const localHours = Number(
239
+ new Intl.DateTimeFormat("en", {
240
+ hour: "numeric",
241
+ hour12: false,
242
+ timeZone: userTimeZone
243
+ }).format(date)
244
+ );
245
+ if (localHours >= 5 && localHours < 8) return "Early Morning";
246
+ if (localHours >= 8 && localHours < 12) return "Morning";
247
+ if (localHours >= 12 && localHours < 14) return "Noon";
248
+ if (localHours >= 14 && localHours < 17) return "Afternoon";
249
+ if (localHours >= 17 && localHours < 20) return "Evening";
250
+ if (localHours >= 20 && localHours < 22) return "Late Evening";
251
+ return "Night";
240
252
  };
241
253
  let localDateTime = "";
242
254
  let timeZoneAbbreviation = "";
243
255
  try {
244
256
  localDateTime = parseAndFormatDate(props.value, props.format);
245
- timeZoneAbbreviation = getTimeZoneAbbreviation(
246
- Intl.DateTimeFormat().resolvedOptions().timeZone
247
- );
257
+ timeZoneAbbreviation = getTimeZoneAbbreviation(userTimeZone);
248
258
  } catch (error) {
249
259
  console.error("Error parsing date:", props.value, error);
250
260
  }
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.20260427125546",
3
+ "version": "0.8.1-dev.20260428094243",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",