@stll/workspace-ui 0.10.1 → 0.10.2
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/field-value.js +8 -3
- package/package.json +3 -2
package/dist/field-value.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Loader2Icon, SquareMinusIcon } from "lucide-react";
|
|
|
5
5
|
import { useFormatter, useLocale, useTranslations } from "use-intl";
|
|
6
6
|
import { formatMoneyCents } from "@stll/money";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Temporal } from "temporal-polyfill/full";
|
|
8
9
|
import { BidiText } from "@stll/ui/bidi-text";
|
|
9
10
|
import { Skeleton } from "@stll/ui/skeleton";
|
|
10
11
|
import { cn } from "@stll/ui/utils";
|
|
@@ -197,8 +198,9 @@ const TextFieldValue = ({ content, variant }) => {
|
|
|
197
198
|
};
|
|
198
199
|
const DateFieldValue = ({ content, property, variant }) => {
|
|
199
200
|
const format = useFormatter();
|
|
200
|
-
const
|
|
201
|
-
|
|
201
|
+
const value = content.value;
|
|
202
|
+
const date = value !== null && /^\d{4}-\d{2}-\d{2}$/u.test(value) ? Result.try(() => Temporal.PlainDate.from(value)).unwrapOr(null) : null;
|
|
203
|
+
if (date === null) {
|
|
202
204
|
if (variant === "table") return /* @__PURE__ */ jsx(SelectFieldValue, {
|
|
203
205
|
property,
|
|
204
206
|
value: null,
|
|
@@ -206,7 +208,10 @@ const DateFieldValue = ({ content, property, variant }) => {
|
|
|
206
208
|
});
|
|
207
209
|
return /* @__PURE__ */ jsx(EmptyFieldValue, { variant });
|
|
208
210
|
}
|
|
209
|
-
const formatted = format.dateTime(date
|
|
211
|
+
const formatted = format.dateTime(date.toZonedDateTime({
|
|
212
|
+
plainTime: Temporal.PlainTime.from("00:00"),
|
|
213
|
+
timeZone: "UTC"
|
|
214
|
+
}).epochMilliseconds, {
|
|
210
215
|
year: "numeric",
|
|
211
216
|
month: "short",
|
|
212
217
|
day: "numeric",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/workspace-ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Reusable workspace presentation components and view helpers for Stella.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calculations",
|
|
@@ -119,9 +119,10 @@
|
|
|
119
119
|
"@stll/calculations": "^0.1.1",
|
|
120
120
|
"@stll/conditions": "^0.3.1",
|
|
121
121
|
"@stll/money": "^0.2.0",
|
|
122
|
-
"@stll/ui": "^0.26.
|
|
122
|
+
"@stll/ui": "^0.26.1",
|
|
123
123
|
"better-result": "3.0.1",
|
|
124
124
|
"lucide-react": "1.39.0",
|
|
125
|
+
"temporal-polyfill": "1.0.4",
|
|
125
126
|
"use-intl": "4.14.2"
|
|
126
127
|
},
|
|
127
128
|
"devDependencies": {
|