mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 07:57:33 +08:00
code refactor
This commit is contained in:
+6
-2
@@ -143,8 +143,8 @@ export function getCurrentUnixTime() {
|
||||
return moment().unix();
|
||||
}
|
||||
|
||||
export function getCurrentDateTime() {
|
||||
return moment();
|
||||
export function getCurrentYear() {
|
||||
return moment().year();
|
||||
}
|
||||
|
||||
export function parseDateFromUnixTime(unixTime, utcOffset, currentUtcOffset) {
|
||||
@@ -167,6 +167,10 @@ export function formatTime(dateTime, format) {
|
||||
return moment(dateTime).format(format);
|
||||
}
|
||||
|
||||
export function formatCurrentTime(format) {
|
||||
return moment().format(format);
|
||||
}
|
||||
|
||||
export function getUnixTime(date) {
|
||||
return moment(date).unix();
|
||||
}
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ import {
|
||||
parseDateFromUnixTime,
|
||||
formatUnixTime,
|
||||
formatTime,
|
||||
getCurrentDateTime,
|
||||
formatCurrentTime,
|
||||
getYear,
|
||||
getTimezoneOffset,
|
||||
getTimezoneOffsetMinutes,
|
||||
@@ -398,7 +398,7 @@ function getDateTimeFormats(translateFn, allFormatMap, allFormatArray, localeFor
|
||||
ret.push({
|
||||
type: datetimeConstants.defaultDateTimeFormatValue,
|
||||
format: defaultFormat,
|
||||
displayName: `${translateFn('Language Default')} (${formatTime(getCurrentDateTime(), defaultFormat)})`
|
||||
displayName: `${translateFn('Language Default')} (${formatCurrentTime(defaultFormat)})`
|
||||
});
|
||||
|
||||
for (let i = 0; i < allFormatArray.length; i++) {
|
||||
@@ -408,7 +408,7 @@ function getDateTimeFormats(translateFn, allFormatMap, allFormatArray, localeFor
|
||||
ret.push({
|
||||
type: formatType.type,
|
||||
format: format,
|
||||
displayName: formatTime(getCurrentDateTime(), format)
|
||||
displayName: formatCurrentTime(format)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user