mirror of
https://github.com/ManInDark/HabitTrove.git
synced 2026-01-20 22:24:28 +01:00
added timezone settings
This commit is contained in:
10
lib/utils.ts
10
lib/utils.ts
@@ -1,6 +1,16 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import moment from "moment-timezone"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function getDateInTimezone(date: Date | string, timezone: string): Date {
|
||||
const m = moment.tz(date, timezone);
|
||||
return new Date(m.format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
|
||||
}
|
||||
|
||||
export function getTodayInTimezone(timezone: string): string {
|
||||
return moment.tz(timezone).format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user