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

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
@@ -1172,8 +1172,15 @@ var DateView = (props) => {
1172
1172
  }).format(date);
1173
1173
  };
1174
1174
  console.log("DateView props:", props);
1175
+ const getLocalDate = (value) => {
1176
+ const now = /* @__PURE__ */ new Date();
1177
+ const offsetMinutes = now.getTimezoneOffset();
1178
+ const offsetMilliseconds = offsetMinutes * 60 * 1e3;
1179
+ const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
1180
+ return new Date(valDate.getTime() - offsetMilliseconds);
1181
+ };
1175
1182
  const parseAndFormatDate = (dateString, format) => {
1176
- const parsedDate = /* @__PURE__ */ new Date(dateString + "Z");
1183
+ const parsedDate = getLocalDate(dateString);
1177
1184
  if (format === "relative") {
1178
1185
  return getRelativeTime(dateString);
1179
1186
  }
@@ -1185,9 +1192,24 @@ var DateView = (props) => {
1185
1192
  year: "numeric"
1186
1193
  }).format(parsedDate);
1187
1194
  case "time":
1188
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(Intl.DateTimeFormat().resolvedOptions().timeZone)} (${getTimePeriod(parsedDate)})`;
1195
+ return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
1196
+ Intl.DateTimeFormat().resolvedOptions().timeZone
1197
+ )} (${getTimePeriod(parsedDate)})`;
1189
1198
  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);
1199
+ return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
1200
+ day: "2-digit",
1201
+ month: "short",
1202
+ year: "numeric",
1203
+ hour: "2-digit",
1204
+ minute: "2-digit"
1205
+ }).format(parsedDate) : new Intl.DateTimeFormat("en", {
1206
+ day: "2-digit",
1207
+ month: "short",
1208
+ year: "numeric",
1209
+ hour: "2-digit",
1210
+ minute: "2-digit",
1211
+ second: "2-digit"
1212
+ }).format(parsedDate);
1191
1213
  }
1192
1214
  };
1193
1215
  const formatTime = (date) => {
@@ -1888,7 +1910,7 @@ var DateTimeInput = (props) => {
1888
1910
  const offsetMinutes = now.getTimezoneOffset();
1889
1911
  const offsetMilliseconds = offsetMinutes * 60 * 1e3;
1890
1912
  const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
1891
- const localDate = new Date(valDate.getTime() + offsetMilliseconds);
1913
+ const localDate = new Date(valDate.getTime() - offsetMilliseconds);
1892
1914
  timeZoneAbbr = now.toLocaleTimeString("en", { timeZoneName: "short" }).split(" ")[2];
1893
1915
  localvalue = localDate?.toISOString()?.slice(0, 16);
1894
1916
  }
package/dist/index.mjs CHANGED
@@ -184,8 +184,15 @@ var DateView = (props) => {
184
184
  }).format(date);
185
185
  };
186
186
  console.log("DateView props:", props);
187
+ const getLocalDate = (value) => {
188
+ const now = /* @__PURE__ */ new Date();
189
+ const offsetMinutes = now.getTimezoneOffset();
190
+ const offsetMilliseconds = offsetMinutes * 60 * 1e3;
191
+ const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
192
+ return new Date(valDate.getTime() - offsetMilliseconds);
193
+ };
187
194
  const parseAndFormatDate = (dateString, format) => {
188
- const parsedDate = /* @__PURE__ */ new Date(dateString + "Z");
195
+ const parsedDate = getLocalDate(dateString);
189
196
  if (format === "relative") {
190
197
  return getRelativeTime(dateString);
191
198
  }
@@ -197,9 +204,24 @@ var DateView = (props) => {
197
204
  year: "numeric"
198
205
  }).format(parsedDate);
199
206
  case "time":
200
- return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(Intl.DateTimeFormat().resolvedOptions().timeZone)} (${getTimePeriod(parsedDate)})`;
207
+ return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
208
+ Intl.DateTimeFormat().resolvedOptions().timeZone
209
+ )} (${getTimePeriod(parsedDate)})`;
201
210
  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);
211
+ return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
212
+ day: "2-digit",
213
+ month: "short",
214
+ year: "numeric",
215
+ hour: "2-digit",
216
+ minute: "2-digit"
217
+ }).format(parsedDate) : new Intl.DateTimeFormat("en", {
218
+ day: "2-digit",
219
+ month: "short",
220
+ year: "numeric",
221
+ hour: "2-digit",
222
+ minute: "2-digit",
223
+ second: "2-digit"
224
+ }).format(parsedDate);
203
225
  }
204
226
  };
205
227
  const formatTime = (date) => {
@@ -900,7 +922,7 @@ var DateTimeInput = (props) => {
900
922
  const offsetMinutes = now.getTimezoneOffset();
901
923
  const offsetMilliseconds = offsetMinutes * 60 * 1e3;
902
924
  const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
903
- const localDate = new Date(valDate.getTime() + offsetMilliseconds);
925
+ const localDate = new Date(valDate.getTime() - offsetMilliseconds);
904
926
  timeZoneAbbr = now.toLocaleTimeString("en", { timeZoneName: "short" }).split(" ")[2];
905
927
  localvalue = localDate?.toISOString()?.slice(0, 16);
906
928
  }
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.20260417073151",
3
+ "version": "0.8.1-dev.20260418060421",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",