chore(FE-147): set moment locale to 'id' globally

This commit is contained in:
ValdiANS
2025-10-23 12:52:51 +07:00
parent 3c8bdfbdac
commit 5e710a792f
+7 -3
View File
@@ -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;
}