|
|
@ -22,8 +22,8 @@ export function adjustedInterval(cb: Function, ms: number) {
|
|
|
|
|
|
|
|
|
|
|
|
export function adjustTz(date: Date, offset: number) {
|
|
|
|
export function adjustTz(date: Date, offset: number) {
|
|
|
|
const currentOffset = date.getTimezoneOffset();
|
|
|
|
const currentOffset = date.getTimezoneOffset();
|
|
|
|
offset = currentOffset - offset * 60;
|
|
|
|
const adjustedOffset = offset * 60;
|
|
|
|
return new Date(date.getTime() + offset * 60000);
|
|
|
|
return new Date(date.getTime() + (currentOffset - adjustedOffset) * 60000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -100,7 +100,7 @@ export function formatDate(date: Date | number | string, format = 'YYYY-MM-DD H:
|
|
|
|
.replaceAll('YY', date.getFullYear().toString().slice(2))
|
|
|
|
.replaceAll('YY', date.getFullYear().toString().slice(2))
|
|
|
|
// Month
|
|
|
|
// Month
|
|
|
|
.replaceAll('MMMM', month(date.getMonth()))
|
|
|
|
.replaceAll('MMMM', month(date.getMonth()))
|
|
|
|
.replaceAll('MMM', month(date.getMonth()).slice(0, 2))
|
|
|
|
.replaceAll('MMM', month(date.getMonth()).slice(0, 3))
|
|
|
|
.replaceAll('MM', (date.getMonth() + 1).toString().padStart(2, '0'))
|
|
|
|
.replaceAll('MM', (date.getMonth() + 1).toString().padStart(2, '0'))
|
|
|
|
.replaceAll('M', (date.getMonth() + 1).toString())
|
|
|
|
.replaceAll('M', (date.getMonth() + 1).toString())
|
|
|
|
// Day
|
|
|
|
// Day
|
|
|
|