@localstack/appinspector-ui 1.0.0-dev-aad3cb1b → 1.0.0-dev-3f04a06e

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.cjs CHANGED
@@ -145,7 +145,7 @@ function unixNanoToDate(unixNanoString) {
145
145
 
146
146
  // src/components/cells/responsive-timestamp-cell.tsx
147
147
  var import_jsx_runtime2 = require("react/jsx-runtime");
148
- var ResponsiveTimestampCell = ({ value }) => {
148
+ var ResponsiveTimestampCell = ({ locale, value }) => {
149
149
  const [columnWidth, setColumnWidth] = (0, import_react2.useState)(0);
150
150
  const cellReference = (0, import_react2.useRef)(null);
151
151
  (0, import_react2.useEffect)(() => {
@@ -171,35 +171,41 @@ var ResponsiveTimestampCell = ({ value }) => {
171
171
  const date = unixNanoToDate(value);
172
172
  if (!date) return;
173
173
  if (columnWidth < 100) {
174
- return date.toLocaleTimeString(void 0, {
174
+ const formatter = new Intl.DateTimeFormat(locale, {
175
175
  hour: "2-digit",
176
176
  hour12: false,
177
177
  minute: "2-digit",
178
178
  second: "2-digit"
179
179
  });
180
+ return formatter.format(date);
180
181
  } else if (columnWidth < 160) {
181
- const timeString = date.toLocaleTimeString(void 0, {
182
+ const formatter = new Intl.DateTimeFormat(locale, {
182
183
  hour: "2-digit",
183
184
  hour12: false,
184
185
  minute: "2-digit",
185
186
  second: "2-digit"
186
187
  });
188
+ const timeString = formatter.format(date);
187
189
  const ms = date.getMilliseconds().toString().padStart(3, "0");
188
190
  return `${timeString}:${ms}`;
189
191
  } else {
190
- const day = date.getDate().toString().padStart(2, "0");
191
- const month = (date.getMonth() + 1).toString().padStart(2, "0");
192
- const year = date.getFullYear().toString();
193
- const timeString = date.toLocaleTimeString(void 0, {
192
+ const dateFormatter = new Intl.DateTimeFormat(locale, {
193
+ day: "2-digit",
194
+ month: "2-digit",
195
+ year: "numeric"
196
+ });
197
+ const timeFormatter = new Intl.DateTimeFormat(locale, {
194
198
  hour: "2-digit",
195
199
  hour12: false,
196
200
  minute: "2-digit",
197
201
  second: "2-digit"
198
202
  });
203
+ const dateString = dateFormatter.format(date);
204
+ const timeString = timeFormatter.format(date);
199
205
  const ms = date.getMilliseconds().toString().padStart(3, "0");
200
- return `${day}.${month}.${year} - ${timeString}:${ms}`;
206
+ return `${dateString} - ${timeString}:${ms}`;
201
207
  }
202
- }, [value, columnWidth]);
208
+ }, [value, columnWidth, locale]);
203
209
  if (!formattedTime) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "N/A" });
204
210
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: cellReference, style: { width: "100%" }, children: formattedTime });
205
211
  };