mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
added timestamps to app console logs
This commit is contained in:
@@ -11,4 +11,21 @@ declare module "dayjs" {
|
||||
|
||||
dayjs.extend(weekOfYear);
|
||||
|
||||
export function datetimeStringLocal(dateOrString?: string | Date | undefined): string {
|
||||
return dayjs(dateOrString).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
|
||||
export function datetimeStringUTC(dateOrString?: string | Date | undefined): string {
|
||||
const date = dateOrString ? new Date(dateOrString) : new Date();
|
||||
return date.toISOString().replace("T", " ").split(".")[0]!;
|
||||
}
|
||||
|
||||
export function getTimezoneOffset(): number {
|
||||
return new Date().getTimezoneOffset();
|
||||
}
|
||||
|
||||
export function getTimezone(): string {
|
||||
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
}
|
||||
|
||||
export { dayjs };
|
||||
|
||||
Reference in New Issue
Block a user