mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
support set timezone
This commit is contained in:
@@ -8,6 +8,7 @@ const serverSettingsCookieKey = 'lab_server_settings';
|
||||
|
||||
const defaultSettings = {
|
||||
lang: 'en',
|
||||
timeZone: '',
|
||||
debug: false,
|
||||
applicationLock: false,
|
||||
applicationLockWebAuthn: false,
|
||||
@@ -128,6 +129,8 @@ export default {
|
||||
isProduction: () => process.env.NODE_ENV === 'production',
|
||||
getLanguage: () => getOriginalOption('lang'),
|
||||
setLanguage: value => setOption('lang', value),
|
||||
getTimezone: () => getOption('timeZone'),
|
||||
setTimezone: value => setOption('timeZone', value),
|
||||
isEnableDebug: () => getOption('debug'),
|
||||
setEnableDebug: value => setOption('debug', value),
|
||||
isEnableApplicationLock: () => getOption('applicationLock'),
|
||||
|
||||
+15
-6
@@ -34,12 +34,20 @@ function isBoolean(val) {
|
||||
return typeof(val) === 'boolean';
|
||||
}
|
||||
|
||||
function parseDateFromUnixTime(unixTime) {
|
||||
return moment.unix(unixTime);
|
||||
function getTimezoneOffset(timezone) {
|
||||
if (timezone) {
|
||||
return moment().tz(timezone).format('Z');
|
||||
} else {
|
||||
return moment().format('Z');
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(date, format) {
|
||||
return moment(date).format(format);
|
||||
function getCurrentUnixTime() {
|
||||
return moment().unix();
|
||||
}
|
||||
|
||||
function parseDateFromUnixTime(unixTime) {
|
||||
return moment.unix(unixTime);
|
||||
}
|
||||
|
||||
function formatUnixTime(unixTime, format) {
|
||||
@@ -107,7 +115,7 @@ function getMinuteLastUnixTime(date) {
|
||||
}
|
||||
|
||||
function getTodayFirstUnixTime() {
|
||||
return moment({ hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||
return moment().set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||
}
|
||||
|
||||
function getTodayLastUnixTime() {
|
||||
@@ -562,8 +570,9 @@ export default {
|
||||
isString,
|
||||
isNumber,
|
||||
isBoolean,
|
||||
getTimezoneOffset,
|
||||
getCurrentUnixTime,
|
||||
parseDateFromUnixTime,
|
||||
formatDate,
|
||||
formatUnixTime,
|
||||
getUnixTime,
|
||||
getYear,
|
||||
|
||||
Reference in New Issue
Block a user