@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 +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -108,7 +108,7 @@ function unixNanoToDate(unixNanoString) {
|
|
|
108
108
|
|
|
109
109
|
// src/components/cells/responsive-timestamp-cell.tsx
|
|
110
110
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
111
|
-
var ResponsiveTimestampCell = ({ value }) => {
|
|
111
|
+
var ResponsiveTimestampCell = ({ locale, value }) => {
|
|
112
112
|
const [columnWidth, setColumnWidth] = useState(0);
|
|
113
113
|
const cellReference = useRef(null);
|
|
114
114
|
useEffect(() => {
|
|
@@ -134,35 +134,41 @@ var ResponsiveTimestampCell = ({ value }) => {
|
|
|
134
134
|
const date = unixNanoToDate(value);
|
|
135
135
|
if (!date) return;
|
|
136
136
|
if (columnWidth < 100) {
|
|
137
|
-
|
|
137
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
138
138
|
hour: "2-digit",
|
|
139
139
|
hour12: false,
|
|
140
140
|
minute: "2-digit",
|
|
141
141
|
second: "2-digit"
|
|
142
142
|
});
|
|
143
|
+
return formatter.format(date);
|
|
143
144
|
} else if (columnWidth < 160) {
|
|
144
|
-
const
|
|
145
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
145
146
|
hour: "2-digit",
|
|
146
147
|
hour12: false,
|
|
147
148
|
minute: "2-digit",
|
|
148
149
|
second: "2-digit"
|
|
149
150
|
});
|
|
151
|
+
const timeString = formatter.format(date);
|
|
150
152
|
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
151
153
|
return `${timeString}:${ms}`;
|
|
152
154
|
} else {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
156
|
+
day: "2-digit",
|
|
157
|
+
month: "2-digit",
|
|
158
|
+
year: "numeric"
|
|
159
|
+
});
|
|
160
|
+
const timeFormatter = new Intl.DateTimeFormat(locale, {
|
|
157
161
|
hour: "2-digit",
|
|
158
162
|
hour12: false,
|
|
159
163
|
minute: "2-digit",
|
|
160
164
|
second: "2-digit"
|
|
161
165
|
});
|
|
166
|
+
const dateString = dateFormatter.format(date);
|
|
167
|
+
const timeString = timeFormatter.format(date);
|
|
162
168
|
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
163
|
-
return `${
|
|
169
|
+
return `${dateString} - ${timeString}:${ms}`;
|
|
164
170
|
}
|
|
165
|
-
}, [value, columnWidth]);
|
|
171
|
+
}, [value, columnWidth, locale]);
|
|
166
172
|
if (!formattedTime) return /* @__PURE__ */ jsx2("span", { children: "N/A" });
|
|
167
173
|
return /* @__PURE__ */ jsx2("div", { ref: cellReference, style: { width: "100%" }, children: formattedTime });
|
|
168
174
|
};
|