mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
chore(FE-147): set moment locale to 'id' globally
This commit is contained in:
+7
-3
@@ -1,7 +1,11 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import 'moment/locale/id';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
import clsx, { ClassValue } from 'clsx';
|
import clsx, { ClassValue } from 'clsx';
|
||||||
|
|
||||||
|
// set locale globally
|
||||||
|
moment.locale('id');
|
||||||
|
|
||||||
export const sleep = (ms: number = 1000) =>
|
export const sleep = (ms: number = 1000) =>
|
||||||
new Promise((resolve) => setTimeout(resolve, ms));
|
new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
@@ -42,9 +46,9 @@ export function getByPath<T, D = undefined>(
|
|||||||
obj: T,
|
obj: T,
|
||||||
path: string,
|
path: string,
|
||||||
defaultValue?: D
|
defaultValue?: D
|
||||||
): unknown | D {
|
): D {
|
||||||
if (obj == null) return defaultValue as D;
|
if (obj == null) return defaultValue as D;
|
||||||
if (!path) return obj as unknown;
|
if (!path) return obj as D;
|
||||||
|
|
||||||
const segments = path.split('.').filter(Boolean);
|
const segments = path.split('.').filter(Boolean);
|
||||||
let cur: { [key: string]: unknown } = obj;
|
let cur: { [key: string]: unknown } = obj;
|
||||||
@@ -59,5 +63,5 @@ export function getByPath<T, D = undefined>(
|
|||||||
cur = cur[key] as { [key: string]: unknown };
|
cur = cur[key] as { [key: string]: unknown };
|
||||||
}
|
}
|
||||||
|
|
||||||
return cur as unknown;
|
return cur as D;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user