@headless-adminapp/app 0.0.17-alpha.24 → 0.0.17-alpha.25
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/app/LayoutProvider.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { RouteProviderProps } from '../route/RouteProvider';
|
|
|
8
8
|
export interface LayoutProviderProps {
|
|
9
9
|
routeProps: RouteProviderProps;
|
|
10
10
|
queryClient: QueryClient;
|
|
11
|
-
localeProps
|
|
11
|
+
localeProps: LocaleProviderProps;
|
|
12
12
|
dataService: IDataService;
|
|
13
13
|
authProps?: AuthProviderProps;
|
|
14
14
|
authPlaceholder?: FC<AuthProviderPlaceholderProps>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Locale } from '@headless-adminapp/core/experience/locale';
|
|
2
2
|
import { FC, PropsWithChildren } from 'react';
|
|
3
3
|
export interface LocaleProviderProps {
|
|
4
|
-
locale
|
|
4
|
+
locale: string;
|
|
5
|
+
timezone: string;
|
|
5
6
|
options?: {
|
|
6
7
|
direction?: Locale['direction'];
|
|
7
8
|
dateFormats?: Locale['dateFormats'];
|
package/locale/LocaleProvider.js
CHANGED
|
@@ -5,10 +5,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const locale_1 = require("@headless-adminapp/core/experience/locale");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const context_1 = require("./context");
|
|
8
|
-
const LocaleProvider = ({ children, locale
|
|
8
|
+
const LocaleProvider = ({ children, locale, timezone, options, }) => {
|
|
9
9
|
const localeState = (0, react_1.useMemo)(() => {
|
|
10
|
-
return (0, locale_1.getLocale)(locale, options);
|
|
11
|
-
}, [locale, options]);
|
|
10
|
+
return (0, locale_1.getLocale)(locale, timezone, options);
|
|
11
|
+
}, [locale, timezone, options]);
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)(context_1.LocaleContext.Provider, { value: localeState, children: children }));
|
|
13
13
|
};
|
|
14
14
|
exports.LocaleProvider = LocaleProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/app",
|
|
3
|
-
"version": "0.0.17-alpha.
|
|
3
|
+
"version": "0.0.17-alpha.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react-hook-form": "7.52.2",
|
|
40
40
|
"yup": "^1.4.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "0a42b982d6113067cd2f9739ec646d138c1a5274"
|
|
43
43
|
}
|
|
@@ -11,5 +11,6 @@ export declare function getAttributeFormattedValue<A extends Attribute = Attribu
|
|
|
11
11
|
currency?: string;
|
|
12
12
|
currencySign?: 'accounting' | 'standard';
|
|
13
13
|
currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code';
|
|
14
|
+
timezone?: string;
|
|
14
15
|
}): string | null | undefined;
|
|
15
16
|
export {};
|
|
@@ -5,6 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getAttributeFormattedValue = getAttributeFormattedValue;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
9
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
10
|
+
dayjs_1.default.extend(utc_1.default);
|
|
11
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
8
12
|
const defaultAttributeFormattedValueStrings = {
|
|
9
13
|
yes: 'Yes',
|
|
10
14
|
no: 'No',
|
|
@@ -44,7 +48,9 @@ function getAttributeFormattedValue(attribute, value, options) {
|
|
|
44
48
|
})
|
|
45
49
|
.join(', ');
|
|
46
50
|
case 'date':
|
|
47
|
-
return (0, dayjs_1.default)(value)
|
|
51
|
+
return (0, dayjs_1.default)(value)
|
|
52
|
+
.tz(options === null || options === void 0 ? void 0 : options.timezone)
|
|
53
|
+
.format(dateFormat);
|
|
48
54
|
case 'daterange':
|
|
49
55
|
if (!value)
|
|
50
56
|
return null;
|
|
@@ -54,13 +60,15 @@ function getAttributeFormattedValue(attribute, value, options) {
|
|
|
54
60
|
return null;
|
|
55
61
|
}
|
|
56
62
|
if (from && to) {
|
|
57
|
-
return ((0, dayjs_1.default)(from).
|
|
63
|
+
return ((0, dayjs_1.default)(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat) +
|
|
64
|
+
' - ' +
|
|
65
|
+
(0, dayjs_1.default)(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat));
|
|
58
66
|
}
|
|
59
67
|
if (from) {
|
|
60
|
-
return 'After ' + (0, dayjs_1.default)(from).format(dateFormat);
|
|
68
|
+
return 'After ' + (0, dayjs_1.default)(from).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
|
|
61
69
|
}
|
|
62
70
|
if (to) {
|
|
63
|
-
return 'Before ' + (0, dayjs_1.default)(to).format(dateFormat);
|
|
71
|
+
return 'Before ' + (0, dayjs_1.default)(to).tz(options === null || options === void 0 ? void 0 : options.timezone).format(dateFormat);
|
|
64
72
|
}
|
|
65
73
|
return null;
|
|
66
74
|
case 'lookup':
|