mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +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/locale/id';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import clsx, { ClassValue } from 'clsx';
|
||||
|
||||
// set locale globally
|
||||
moment.locale('id');
|
||||
|
||||
export const sleep = (ms: number = 1000) =>
|
||||
new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
@@ -42,9 +46,9 @@ export function getByPath<T, D = undefined>(
|
||||
obj: T,
|
||||
path: string,
|
||||
defaultValue?: D
|
||||
): unknown | D {
|
||||
): 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);
|
||||
let cur: { [key: string]: unknown } = obj;
|
||||
@@ -59,5 +63,5 @@ export function getByPath<T, D = undefined>(
|
||||
cur = cur[key] as { [key: string]: unknown };
|
||||
}
|
||||
|
||||
return cur as unknown;
|
||||
return cur as D;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user