mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
fix the dates in Statistics & Analysis page does not be processed for daylight saving time
This commit is contained in:
@@ -521,6 +521,10 @@ export function getBrowserTimezoneOffsetMinutes(): number {
|
||||
return -new Date().getTimezoneOffset();
|
||||
}
|
||||
|
||||
export function guessTimezoneName(): string {
|
||||
return moment.tz.guess(true);
|
||||
}
|
||||
|
||||
export function getLocalDatetimeFromUnixTime(unixTime: number): Date {
|
||||
return new Date(unixTime * 1000);
|
||||
}
|
||||
|
||||
+15
-1
@@ -167,13 +167,19 @@ import {
|
||||
isBoolean,
|
||||
objectFieldWithValueToArrayItem
|
||||
} from './common.ts';
|
||||
import {
|
||||
getTimeZone
|
||||
} from './settings.ts';
|
||||
import {
|
||||
getGoogleMapAPIKey,
|
||||
getBaiduMapAK,
|
||||
getAmapApplicationKey,
|
||||
getExchangeRatesRequestTimeout
|
||||
} from './server_settings.ts';
|
||||
import { getTimezoneOffsetMinutes } from './datetime.ts';
|
||||
import {
|
||||
getTimezoneOffsetMinutes,
|
||||
guessTimezoneName
|
||||
} from './datetime.ts';
|
||||
import { generateRandomUUID } from './misc.ts';
|
||||
import { getBasePath } from './web.ts';
|
||||
import logger from './logger.ts';
|
||||
@@ -204,6 +210,14 @@ axios.interceptors.request.use((config: ApiRequestConfig) => {
|
||||
|
||||
config.headers['X-Timezone-Offset'] = getTimezoneOffsetMinutes();
|
||||
|
||||
let timezoneName = getTimeZone();
|
||||
|
||||
if (!timezoneName || timezoneName.trim().length < 1) {
|
||||
timezoneName = guessTimezoneName();
|
||||
}
|
||||
|
||||
config.headers['X-Timezone-Name'] = timezoneName;
|
||||
|
||||
if (needBlockRequest && !config.ignoreBlocked) {
|
||||
return new Promise(resolve => {
|
||||
blockedRequests.push(newToken => {
|
||||
|
||||
@@ -89,6 +89,10 @@ export function getTheme(): string {
|
||||
return getApplicationSettings().theme;
|
||||
}
|
||||
|
||||
export function getTimeZone(): string {
|
||||
return getApplicationSettings().timeZone;
|
||||
}
|
||||
|
||||
export function isEnableApplicationLock(): boolean {
|
||||
return getApplicationSettings().applicationLock;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user