@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260418101320 → 0.8.1-dev.20260418121424
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 +14 -12
- package/dist/index.mjs +14 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1150,10 +1150,10 @@ var timeZoneAbbreviations = {
|
|
|
1150
1150
|
// src/components/controls/view/DateView.tsx
|
|
1151
1151
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1152
1152
|
var DateView = (props) => {
|
|
1153
|
+
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1153
1154
|
const getTimeZoneAbbreviation = (timeZone) => {
|
|
1154
1155
|
return timeZoneAbbreviations[timeZone] || timeZone;
|
|
1155
1156
|
};
|
|
1156
|
-
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1157
1157
|
const getRelativeTime = (dateString) => {
|
|
1158
1158
|
const now = /* @__PURE__ */ new Date();
|
|
1159
1159
|
const date = new Date(
|
|
@@ -1169,6 +1169,7 @@ var DateView = (props) => {
|
|
|
1169
1169
|
if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
|
|
1170
1170
|
if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
|
|
1171
1171
|
return new Intl.DateTimeFormat("en", {
|
|
1172
|
+
timeZone: userTimeZone,
|
|
1172
1173
|
day: "2-digit",
|
|
1173
1174
|
month: "short",
|
|
1174
1175
|
year: "numeric"
|
|
@@ -1202,37 +1203,38 @@ var DateView = (props) => {
|
|
|
1202
1203
|
if (format === "relative") {
|
|
1203
1204
|
return getRelativeTime(dateString);
|
|
1204
1205
|
}
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
const valDate = dateString.includes("Z") ? new Date(dateString) : /* @__PURE__ */ new Date(dateString + "Z");
|
|
1209
|
-
const localDate = new Date(valDate.getTime() - offsetMilliseconds);
|
|
1206
|
+
const parsedDate = new Date(
|
|
1207
|
+
dateString.includes("Z") ? dateString : dateString + "Z"
|
|
1208
|
+
);
|
|
1210
1209
|
if (props.controlType === "date") {
|
|
1211
1210
|
return new Intl.DateTimeFormat("en", {
|
|
1211
|
+
timeZone: userTimeZone,
|
|
1212
1212
|
day: "2-digit",
|
|
1213
1213
|
month: "short",
|
|
1214
1214
|
year: "numeric"
|
|
1215
|
-
}).format(
|
|
1215
|
+
}).format(parsedDate);
|
|
1216
1216
|
}
|
|
1217
1217
|
if (props.controlType === "time") {
|
|
1218
|
-
return `${formatTime(
|
|
1218
|
+
return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
|
|
1219
1219
|
userTimeZone
|
|
1220
|
-
)} (${getTimePeriod(
|
|
1220
|
+
)} (${getTimePeriod(parsedDate)})`;
|
|
1221
1221
|
}
|
|
1222
|
-
return
|
|
1222
|
+
return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
|
|
1223
|
+
timeZone: userTimeZone,
|
|
1223
1224
|
day: "2-digit",
|
|
1224
1225
|
month: "short",
|
|
1225
1226
|
year: "numeric",
|
|
1226
1227
|
hour: "2-digit",
|
|
1227
1228
|
minute: "2-digit"
|
|
1228
|
-
}).format(
|
|
1229
|
+
}).format(parsedDate) : new Intl.DateTimeFormat("en", {
|
|
1230
|
+
timeZone: userTimeZone,
|
|
1229
1231
|
day: "2-digit",
|
|
1230
1232
|
month: "short",
|
|
1231
1233
|
year: "numeric",
|
|
1232
1234
|
hour: "2-digit",
|
|
1233
1235
|
minute: "2-digit",
|
|
1234
1236
|
second: "2-digit"
|
|
1235
|
-
}).format(
|
|
1237
|
+
}).format(parsedDate);
|
|
1236
1238
|
};
|
|
1237
1239
|
let localDateTime = "";
|
|
1238
1240
|
let timeZoneAbbreviation = "";
|
package/dist/index.mjs
CHANGED
|
@@ -162,10 +162,10 @@ var timeZoneAbbreviations = {
|
|
|
162
162
|
// src/components/controls/view/DateView.tsx
|
|
163
163
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
164
164
|
var DateView = (props) => {
|
|
165
|
+
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
165
166
|
const getTimeZoneAbbreviation = (timeZone) => {
|
|
166
167
|
return timeZoneAbbreviations[timeZone] || timeZone;
|
|
167
168
|
};
|
|
168
|
-
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
169
169
|
const getRelativeTime = (dateString) => {
|
|
170
170
|
const now = /* @__PURE__ */ new Date();
|
|
171
171
|
const date = new Date(
|
|
@@ -181,6 +181,7 @@ var DateView = (props) => {
|
|
|
181
181
|
if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
|
|
182
182
|
if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
|
|
183
183
|
return new Intl.DateTimeFormat("en", {
|
|
184
|
+
timeZone: userTimeZone,
|
|
184
185
|
day: "2-digit",
|
|
185
186
|
month: "short",
|
|
186
187
|
year: "numeric"
|
|
@@ -214,37 +215,38 @@ var DateView = (props) => {
|
|
|
214
215
|
if (format === "relative") {
|
|
215
216
|
return getRelativeTime(dateString);
|
|
216
217
|
}
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const valDate = dateString.includes("Z") ? new Date(dateString) : /* @__PURE__ */ new Date(dateString + "Z");
|
|
221
|
-
const localDate = new Date(valDate.getTime() - offsetMilliseconds);
|
|
218
|
+
const parsedDate = new Date(
|
|
219
|
+
dateString.includes("Z") ? dateString : dateString + "Z"
|
|
220
|
+
);
|
|
222
221
|
if (props.controlType === "date") {
|
|
223
222
|
return new Intl.DateTimeFormat("en", {
|
|
223
|
+
timeZone: userTimeZone,
|
|
224
224
|
day: "2-digit",
|
|
225
225
|
month: "short",
|
|
226
226
|
year: "numeric"
|
|
227
|
-
}).format(
|
|
227
|
+
}).format(parsedDate);
|
|
228
228
|
}
|
|
229
229
|
if (props.controlType === "time") {
|
|
230
|
-
return `${formatTime(
|
|
230
|
+
return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
|
|
231
231
|
userTimeZone
|
|
232
|
-
)} (${getTimePeriod(
|
|
232
|
+
)} (${getTimePeriod(parsedDate)})`;
|
|
233
233
|
}
|
|
234
|
-
return
|
|
234
|
+
return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
|
|
235
|
+
timeZone: userTimeZone,
|
|
235
236
|
day: "2-digit",
|
|
236
237
|
month: "short",
|
|
237
238
|
year: "numeric",
|
|
238
239
|
hour: "2-digit",
|
|
239
240
|
minute: "2-digit"
|
|
240
|
-
}).format(
|
|
241
|
+
}).format(parsedDate) : new Intl.DateTimeFormat("en", {
|
|
242
|
+
timeZone: userTimeZone,
|
|
241
243
|
day: "2-digit",
|
|
242
244
|
month: "short",
|
|
243
245
|
year: "numeric",
|
|
244
246
|
hour: "2-digit",
|
|
245
247
|
minute: "2-digit",
|
|
246
248
|
second: "2-digit"
|
|
247
|
-
}).format(
|
|
249
|
+
}).format(parsedDate);
|
|
248
250
|
};
|
|
249
251
|
let localDateTime = "";
|
|
250
252
|
let timeZoneAbbreviation = "";
|
package/package.json
CHANGED