@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260417073613 → 0.8.1-dev.20260418061226

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);
@@ -1172,8 +1174,17 @@ var DateView = (props) => {
1172
1174
  }).format(date);
1173
1175
  };
1174
1176
  console.log("DateView props:", props);
1177
+ const getLocalDate = (value) => {
1178
+ const now = /* @__PURE__ */ new Date();
1179
+ const offsetMinutes = now.getTimezoneOffset();
1180
+ const offsetMilliseconds = offsetMinutes * 60 * 1e3;
1181
+ const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
1182
+ return new Date(valDate.getTime() - offsetMilliseconds);
1183
+ };
1175
1184
  const parseAndFormatDate = (dateString, format) => {
1176
- const parsedDate = /* @__PURE__ */ new Date(dateString + "Z");
1185
+ const parsedDate = new Date(
1186
+ dateString.includes("Z") ? dateString : dateString + "Z"
1187
+ );
1177
1188
  if (format === "relative") {
1178
1189
  return getRelativeTime(dateString);
1179
1190
  }
@@ -1185,9 +1196,24 @@ var DateView = (props) => {
1185
1196
  year: "numeric"
1186
1197
  }).format(parsedDate);
1187
1198
  case "time":
1188
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(Intl.DateTimeFormat().resolvedOptions().timeZone)} (${getTimePeriod(parsedDate)})`;
1199
+ return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
1200
+ Intl.DateTimeFormat().resolvedOptions().timeZone
1201
+ )} (${getTimePeriod(parsedDate)})`;
1189
1202
  default:
1190
- return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", { day: "2-digit", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" }).format(parsedDate) : new Intl.DateTimeFormat("en", { day: "2-digit", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit" }).format(parsedDate);
1203
+ return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1204
+ day: "2-digit",
1205
+ month: "short",
1206
+ year: "numeric",
1207
+ hour: "2-digit",
1208
+ minute: "2-digit"
1209
+ }).format(parsedDate) : new Intl.DateTimeFormat("en", {
1210
+ day: "2-digit",
1211
+ month: "short",
1212
+ year: "numeric",
1213
+ hour: "2-digit",
1214
+ minute: "2-digit",
1215
+ second: "2-digit"
1216
+ }).format(parsedDate);
1191
1217
  }
1192
1218
  };
1193
1219
  const formatTime = (date) => {
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);
@@ -184,8 +186,17 @@ var DateView = (props) => {
184
186
  }).format(date);
185
187
  };
186
188
  console.log("DateView props:", props);
189
+ const getLocalDate = (value) => {
190
+ const now = /* @__PURE__ */ new Date();
191
+ const offsetMinutes = now.getTimezoneOffset();
192
+ const offsetMilliseconds = offsetMinutes * 60 * 1e3;
193
+ const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
194
+ return new Date(valDate.getTime() - offsetMilliseconds);
195
+ };
187
196
  const parseAndFormatDate = (dateString, format) => {
188
- const parsedDate = /* @__PURE__ */ new Date(dateString + "Z");
197
+ const parsedDate = new Date(
198
+ dateString.includes("Z") ? dateString : dateString + "Z"
199
+ );
189
200
  if (format === "relative") {
190
201
  return getRelativeTime(dateString);
191
202
  }
@@ -197,9 +208,24 @@ var DateView = (props) => {
197
208
  year: "numeric"
198
209
  }).format(parsedDate);
199
210
  case "time":
200
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(Intl.DateTimeFormat().resolvedOptions().timeZone)} (${getTimePeriod(parsedDate)})`;
211
+ return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
212
+ Intl.DateTimeFormat().resolvedOptions().timeZone
213
+ )} (${getTimePeriod(parsedDate)})`;
201
214
  default:
202
- return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", { day: "2-digit", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" }).format(parsedDate) : new Intl.DateTimeFormat("en", { day: "2-digit", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit" }).format(parsedDate);
215
+ return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
216
+ day: "2-digit",
217
+ month: "short",
218
+ year: "numeric",
219
+ hour: "2-digit",
220
+ minute: "2-digit"
221
+ }).format(parsedDate) : new Intl.DateTimeFormat("en", {
222
+ day: "2-digit",
223
+ month: "short",
224
+ year: "numeric",
225
+ hour: "2-digit",
226
+ minute: "2-digit",
227
+ second: "2-digit"
228
+ }).format(parsedDate);
203
229
  }
204
230
  };
205
231
  const formatTime = (date) => {
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.20260417073613",
3
+ "version": "0.8.1-dev.20260418061226",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",