mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 01:04:25 +08:00
migrate lib/datetime.js to ts
This commit is contained in:
@@ -73,7 +73,7 @@ import {
|
|||||||
getTimezoneOffsetMinutes,
|
getTimezoneOffsetMinutes,
|
||||||
getBrowserTimezoneOffsetMinutes,
|
getBrowserTimezoneOffsetMinutes,
|
||||||
getDateRangeByDateType
|
getDateRangeByDateType
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import {
|
|||||||
getLocalDatetimeFromUnixTime,
|
getLocalDatetimeFromUnixTime,
|
||||||
getActualUnixTimeForStore,
|
getActualUnixTimeForStore,
|
||||||
getUnixTime
|
getUnixTime
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ import {
|
|||||||
getThisYearFirstUnixTime,
|
getThisYearFirstUnixTime,
|
||||||
getYearMonthFirstUnixTime,
|
getYearMonthFirstUnixTime,
|
||||||
getYearMonthLastUnixTime
|
getYearMonthLastUnixTime
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
getYearMonthFirstUnixTime,
|
getYearMonthFirstUnixTime,
|
||||||
getYearMonthLastUnixTime,
|
getYearMonthLastUnixTime,
|
||||||
getDateTypeByDateRange
|
getDateTypeByDateRange
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import {
|
import {
|
||||||
sortStatisticsItems,
|
sortStatisticsItems,
|
||||||
getAllDateRanges
|
getAllDateRanges
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ import {
|
|||||||
getTimezoneOffsetMinutes,
|
getTimezoneOffsetMinutes,
|
||||||
getBrowserTimezoneOffsetMinutes,
|
getBrowserTimezoneOffsetMinutes,
|
||||||
getDateRangeByDateType
|
getDateRangeByDateType
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import {
|
|||||||
getTimezoneOffsetMinutes,
|
getTimezoneOffsetMinutes,
|
||||||
getTimeValues,
|
getTimeValues,
|
||||||
getCombinedDateAndTimeValues
|
getCombinedDateAndTimeValues
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { createInlinePicker } from '@/lib/ui/mobile.js';
|
import { createInlinePicker } from '@/lib/ui/mobile.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import {
|
|||||||
getThisYearFirstUnixTime,
|
getThisYearFirstUnixTime,
|
||||||
getYearMonthFirstUnixTime,
|
getYearMonthFirstUnixTime,
|
||||||
getYearMonthLastUnixTime
|
getYearMonthLastUnixTime
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ import {
|
|||||||
getYearMonthFirstUnixTime,
|
getYearMonthFirstUnixTime,
|
||||||
getYearMonthLastUnixTime,
|
getYearMonthLastUnixTime,
|
||||||
getDateTypeByDateRange
|
getDateTypeByDateRange
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import {
|
import {
|
||||||
sortStatisticsItems,
|
sortStatisticsItems,
|
||||||
getAllDateRanges
|
getAllDateRanges
|
||||||
|
|||||||
@@ -1,5 +1,109 @@
|
|||||||
import type { TypeAndName } from '@/core/base.ts';
|
import type { TypeAndName } from '@/core/base.ts';
|
||||||
|
|
||||||
|
export interface YearQuarter {
|
||||||
|
readonly year: number;
|
||||||
|
readonly quarter: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface YearMonth {
|
||||||
|
readonly year: number;
|
||||||
|
readonly month: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface YearMonthRange {
|
||||||
|
readonly startYearMonth: YearMonth;
|
||||||
|
readonly endYearMonth: YearMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TimeRange {
|
||||||
|
readonly minTime: number;
|
||||||
|
readonly maxTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UnixTimeRange {
|
||||||
|
readonly minUnixTime: number;
|
||||||
|
readonly maxUnixTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TimeRangeAndDateType extends TimeRange {
|
||||||
|
readonly dateType: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TimeDifference {
|
||||||
|
readonly offsetHours: number;
|
||||||
|
readonly offsetMinutes: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RecentMonthDateRange {
|
||||||
|
readonly dateType: number;
|
||||||
|
readonly minTime: number;
|
||||||
|
readonly maxTime: number;
|
||||||
|
readonly year: number;
|
||||||
|
readonly month: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LocalizedRecentMonthDateRange {
|
||||||
|
readonly dateType: number;
|
||||||
|
readonly minTime: number;
|
||||||
|
readonly maxTime: number;
|
||||||
|
readonly year?: number;
|
||||||
|
readonly month?: number;
|
||||||
|
readonly isPreset?: boolean;
|
||||||
|
readonly displayName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class YearUnixTime implements UnixTimeRange {
|
||||||
|
public readonly year: number;
|
||||||
|
public readonly minUnixTime: number;
|
||||||
|
public readonly maxUnixTime: number;
|
||||||
|
|
||||||
|
private constructor(year: number, minUnixTime: number, maxUnixTime: number) {
|
||||||
|
this.year = year;
|
||||||
|
this.minUnixTime = minUnixTime;
|
||||||
|
this.maxUnixTime = maxUnixTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static of(year: number, minUnixTime: number, maxUnixTime: number): YearUnixTime {
|
||||||
|
return new YearUnixTime(year, minUnixTime, maxUnixTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class YearQuarterUnixTime implements YearQuarter, UnixTimeRange {
|
||||||
|
public readonly year: number;
|
||||||
|
public readonly quarter: number;
|
||||||
|
public readonly minUnixTime: number;
|
||||||
|
public readonly maxUnixTime: number;
|
||||||
|
|
||||||
|
private constructor(year: number, quarter: number, minUnixTime: number, maxUnixTime: number) {
|
||||||
|
this.year = year;
|
||||||
|
this.quarter = quarter;
|
||||||
|
this.minUnixTime = minUnixTime;
|
||||||
|
this.maxUnixTime = maxUnixTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static of(yearQuarter: YearQuarter, minUnixTime: number, maxUnixTime: number): YearQuarterUnixTime {
|
||||||
|
return new YearQuarterUnixTime(yearQuarter.year, yearQuarter.quarter, minUnixTime, maxUnixTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class YearMonthUnixTime implements YearMonth, UnixTimeRange {
|
||||||
|
public readonly year: number;
|
||||||
|
public readonly month: number;
|
||||||
|
public readonly minUnixTime: number;
|
||||||
|
public readonly maxUnixTime: number;
|
||||||
|
|
||||||
|
private constructor(year: number, month: number, minUnixTime: number, maxUnixTime: number) {
|
||||||
|
this.year = year;
|
||||||
|
this.month = month;
|
||||||
|
this.minUnixTime = minUnixTime;
|
||||||
|
this.maxUnixTime = maxUnixTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static of(yearMonth: YearMonth, minUnixTime: number, maxUnixTime: number): YearMonthUnixTime {
|
||||||
|
return new YearMonthUnixTime(yearMonth.year, yearMonth.month, minUnixTime, maxUnixTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Month {
|
export class Month {
|
||||||
private static readonly allInstances: Month[] = [];
|
private static readonly allInstances: Month[] = [];
|
||||||
|
|
||||||
@@ -380,3 +484,7 @@ export class DateRange implements TypeAndName {
|
|||||||
return dateRange?.isBillingCycle || false;
|
return dateRange?.isBillingCycle || false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AllDateTimeFormatMap = Record<string, LongDateFormat> | Record<string, ShortDateFormat> | Record<string, LongTimeFormat> | Record<string, ShortTimeFormat>;
|
||||||
|
export type AllDateTimeFormatArray = LongDateFormat[] | ShortDateFormat[] | LongTimeFormat[] | ShortTimeFormat[];
|
||||||
|
export type AllDateTimeFormatType = LongDateFormat | ShortDateFormat | LongTimeFormat | ShortTimeFormat;
|
||||||
|
|||||||
@@ -1,9 +1,37 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment-timezone';
|
||||||
|
import { type unitOfTime } from 'moment/moment';
|
||||||
|
|
||||||
import { Month, WeekDay, MeridiemIndicator, DateRangeScene, DateRange, LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE } from '@/core/datetime.ts';
|
import {
|
||||||
import { isObject, isString, isNumber } from './common.ts';
|
type YearUnixTime,
|
||||||
|
type YearQuarter,
|
||||||
|
type YearMonth,
|
||||||
|
type YearMonthRange,
|
||||||
|
type TimeRange,
|
||||||
|
type TimeRangeAndDateType,
|
||||||
|
type TimeDifference,
|
||||||
|
type RecentMonthDateRange,
|
||||||
|
type LocalizedRecentMonthDateRange,
|
||||||
|
type AllDateTimeFormatMap,
|
||||||
|
type AllDateTimeFormatArray,
|
||||||
|
type AllDateTimeFormatType,
|
||||||
|
YearQuarterUnixTime,
|
||||||
|
YearMonthUnixTime,
|
||||||
|
Month,
|
||||||
|
WeekDay,
|
||||||
|
MeridiemIndicator,
|
||||||
|
DateRangeScene,
|
||||||
|
DateRange,
|
||||||
|
LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE
|
||||||
|
} from '@/core/datetime.ts';
|
||||||
|
import {
|
||||||
|
isObject,
|
||||||
|
isString,
|
||||||
|
isNumber
|
||||||
|
} from './common.ts';
|
||||||
|
|
||||||
export function isYearMonthValid(year, month) {
|
type SupportedDate = Date | moment.Moment;
|
||||||
|
|
||||||
|
export function isYearMonthValid(year: number, month: number): boolean {
|
||||||
if (!isNumber(year) || !isNumber(month)) {
|
if (!isNumber(year) || !isNumber(month)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -11,7 +39,7 @@ export function isYearMonthValid(year, month) {
|
|||||||
return year > 0 && month >= 0 && month <= 11;
|
return year > 0 && month >= 0 && month <= 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearMonthObjectFromString(yearMonth) {
|
export function getYearMonthObjectFromString(yearMonth: string): YearMonth | null {
|
||||||
if (!isString(yearMonth)) {
|
if (!isString(yearMonth)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -35,7 +63,7 @@ export function getYearMonthObjectFromString(yearMonth) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearMonthStringFromObject(yearMonth) {
|
export function getYearMonthStringFromObject(yearMonth: YearMonth | null): string {
|
||||||
if (!yearMonth || !isYearMonthValid(yearMonth.year, yearMonth.month)) {
|
if (!yearMonth || !isYearMonthValid(yearMonth.year, yearMonth.month)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -43,7 +71,7 @@ export function getYearMonthStringFromObject(yearMonth) {
|
|||||||
return `${yearMonth.year}-${yearMonth.month + 1}`;
|
return `${yearMonth.year}-${yearMonth.month + 1}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTwoDigitsString(value) {
|
export function getTwoDigitsString(value: number): string {
|
||||||
if (value < 10) {
|
if (value < 10) {
|
||||||
return '0' + value;
|
return '0' + value;
|
||||||
} else {
|
} else {
|
||||||
@@ -51,7 +79,7 @@ export function getTwoDigitsString(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getHourIn12HourFormat(hour) {
|
export function getHourIn12HourFormat(hour: number): number {
|
||||||
hour = hour % 12;
|
hour = hour % 12;
|
||||||
|
|
||||||
if (hour === 0) {
|
if (hour === 0) {
|
||||||
@@ -61,7 +89,7 @@ export function getHourIn12HourFormat(hour) {
|
|||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPM(hour) {
|
export function isPM(hour: number): boolean {
|
||||||
if (hour > 11) {
|
if (hour > 11) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -69,26 +97,29 @@ export function isPM(hour) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUtcOffsetByUtcOffsetMinutes(utcOffsetMinutes) {
|
export function getUtcOffsetByUtcOffsetMinutes(utcOffsetMinutes: number): string {
|
||||||
let offsetHours = Math.trunc(Math.abs(utcOffsetMinutes) / 60);
|
const offsetHours = Math.trunc(Math.abs(utcOffsetMinutes) / 60);
|
||||||
let offsetMinutes = Math.abs(utcOffsetMinutes) - offsetHours * 60;
|
const offsetMinutes = Math.abs(utcOffsetMinutes) - offsetHours * 60;
|
||||||
|
|
||||||
|
let finalOffsetHours = offsetHours.toString();
|
||||||
|
let finalOffsetMinutes = offsetMinutes.toString();
|
||||||
|
|
||||||
if (offsetHours < 10) {
|
if (offsetHours < 10) {
|
||||||
offsetHours = '0' + offsetHours;
|
finalOffsetHours = '0' + offsetHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offsetMinutes < 10) {
|
if (offsetMinutes < 10) {
|
||||||
offsetMinutes = '0' + offsetMinutes;
|
finalOffsetMinutes = '0' + offsetMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utcOffsetMinutes >= 0) {
|
if (utcOffsetMinutes >= 0) {
|
||||||
return `+${offsetHours}:${offsetMinutes}`;
|
return `+${finalOffsetHours}:${finalOffsetMinutes}`;
|
||||||
} else if (utcOffsetMinutes < 0) {
|
} else {
|
||||||
return `-${offsetHours}:${offsetMinutes}`;
|
return `-${finalOffsetHours}:${finalOffsetMinutes}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTimezoneOffset(timezone) {
|
export function getTimezoneOffset(timezone?: string): string {
|
||||||
if (timezone) {
|
if (timezone) {
|
||||||
return moment().tz(timezone).format('Z');
|
return moment().tz(timezone).format('Z');
|
||||||
} else {
|
} else {
|
||||||
@@ -96,7 +127,7 @@ export function getTimezoneOffset(timezone) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTimezoneOffsetMinutes(timezone) {
|
export function getTimezoneOffsetMinutes(timezone?: string): number {
|
||||||
if (timezone) {
|
if (timezone) {
|
||||||
return moment().tz(timezone).utcOffset();
|
return moment().tz(timezone).utcOffset();
|
||||||
} else {
|
} else {
|
||||||
@@ -112,79 +143,79 @@ export function getBrowserTimezoneOffsetMinutes() {
|
|||||||
return -new Date().getTimezoneOffset();
|
return -new Date().getTimezoneOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLocalDatetimeFromUnixTime(unixTime) {
|
export function getLocalDatetimeFromUnixTime(unixTime: number): Date {
|
||||||
return new Date(unixTime * 1000);
|
return new Date(unixTime * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUnixTimeFromLocalDatetime(datetime) {
|
export function getUnixTimeFromLocalDatetime(datetime: Date): number {
|
||||||
return datetime.getTime() / 1000;
|
return datetime.getTime() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getActualUnixTimeForStore(unixTime, utcOffset, currentUtcOffset) {
|
export function getActualUnixTimeForStore(unixTime: number, utcOffset: number, currentUtcOffset: number): number {
|
||||||
return unixTime - (utcOffset - currentUtcOffset) * 60;
|
return unixTime - (utcOffset - currentUtcOffset) * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDummyUnixTimeForLocalUsage(unixTime, utcOffset, currentUtcOffset) {
|
export function getDummyUnixTimeForLocalUsage(unixTime: number, utcOffset: number, currentUtcOffset: number): number {
|
||||||
return unixTime + (utcOffset - currentUtcOffset) * 60;
|
return unixTime + (utcOffset - currentUtcOffset) * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentUnixTime() {
|
export function getCurrentUnixTime(): number {
|
||||||
return moment().unix();
|
return moment().unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentYear() {
|
export function getCurrentYear(): number {
|
||||||
return moment().year();
|
return moment().year();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentDay() {
|
export function getCurrentDay(): number {
|
||||||
return moment().date();
|
return moment().date();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseDateFromUnixTime(unixTime, utcOffset, currentUtcOffset) {
|
export function parseDateFromUnixTime(unixTime: number, utcOffset?: number, currentUtcOffset?: number): moment.Moment {
|
||||||
if (isNumber(utcOffset)) {
|
if (isNumber(utcOffset)) {
|
||||||
if (!isNumber(currentUtcOffset)) {
|
if (!isNumber(currentUtcOffset)) {
|
||||||
currentUtcOffset = getTimezoneOffsetMinutes();
|
currentUtcOffset = getTimezoneOffsetMinutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
unixTime = getDummyUnixTimeForLocalUsage(unixTime, utcOffset, currentUtcOffset);
|
unixTime = getDummyUnixTimeForLocalUsage(unixTime, utcOffset as number, currentUtcOffset as number);
|
||||||
}
|
}
|
||||||
|
|
||||||
return moment.unix(unixTime);
|
return moment.unix(unixTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatUnixTime(unixTime, format, utcOffset, currentUtcOffset) {
|
export function formatUnixTime(unixTime: number, format: string, utcOffset?: number, currentUtcOffset?: number) {
|
||||||
return parseDateFromUnixTime(unixTime, utcOffset, currentUtcOffset).format(format);
|
return parseDateFromUnixTime(unixTime, utcOffset, currentUtcOffset).format(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatCurrentTime(format) {
|
export function formatCurrentTime(format: string): string {
|
||||||
return moment().format(format);
|
return moment().format(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUnixTime(date) {
|
export function getUnixTime(date: SupportedDate): number {
|
||||||
return moment(date).unix();
|
return moment(date).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getShortDate(date) {
|
export function getShortDate(date: SupportedDate): string {
|
||||||
date = moment(date);
|
date = moment(date);
|
||||||
return date.year() + '-' + (date.month() + 1) + '-' + date.date();
|
return date.year() + '-' + (date.month() + 1) + '-' + date.date();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYear(date) {
|
export function getYear(date: SupportedDate): number {
|
||||||
return moment(date).year();
|
return moment(date).year();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMonth(date) {
|
export function getMonth(date: SupportedDate): number {
|
||||||
return moment(date).month() + 1;
|
return moment(date).month() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearAndMonth(date) {
|
export function getYearAndMonth(date: SupportedDate): string {
|
||||||
const year = getYear(date);
|
const year = getYear(date);
|
||||||
let month = getMonth(date);
|
const month = getMonth(date);
|
||||||
|
|
||||||
return `${year}-${month}`;
|
return `${year}-${month}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearAndMonthFromUnixTime(unixTime) {
|
export function getYearAndMonthFromUnixTime(unixTime: number): string {
|
||||||
if (!unixTime) {
|
if (!unixTime) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -192,35 +223,35 @@ export function getYearAndMonthFromUnixTime(unixTime) {
|
|||||||
return getYearAndMonth(parseDateFromUnixTime(unixTime));
|
return getYearAndMonth(parseDateFromUnixTime(unixTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDay(date) {
|
export function getDay(date: SupportedDate): number {
|
||||||
return moment(date).date();
|
return moment(date).date();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDayOfWeekName(date) {
|
export function getDayOfWeekName(date: SupportedDate): string {
|
||||||
const dayOfWeek = moment(date).days();
|
const dayOfWeek = moment(date).days();
|
||||||
return WeekDay.valueOf(dayOfWeek).name;
|
return WeekDay.valueOf(dayOfWeek).name;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMonthName(date) {
|
export function getMonthName(date: SupportedDate): string {
|
||||||
const month = moment(date).month();
|
const month = moment(date).month();
|
||||||
return Month.valueOf(month + 1).name;
|
return Month.valueOf(month + 1).name;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAMOrPM(hour) {
|
export function getAMOrPM(hour: number): string {
|
||||||
return isPM(hour) ? MeridiemIndicator.PM.name : MeridiemIndicator.AM.name;
|
return isPM(hour) ? MeridiemIndicator.PM.name : MeridiemIndicator.AM.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUnixTimeBeforeUnixTime(unixTime, amount, unit) {
|
export function getUnixTimeBeforeUnixTime(unixTime: number, amount: number, unit: unitOfTime.DurationConstructor): number {
|
||||||
return moment.unix(unixTime).subtract(amount, unit).unix();
|
return moment.unix(unixTime).subtract(amount, unit).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUnixTimeAfterUnixTime(unixTime, amount, unit) {
|
export function getUnixTimeAfterUnixTime(unixTime: number, amount: number, unit: unitOfTime.DurationConstructor): number {
|
||||||
return moment.unix(unixTime).add(amount, unit).unix();
|
return moment.unix(unixTime).add(amount, unit).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTimeDifferenceHoursAndMinutes(timeDifferenceInMinutes) {
|
export function getTimeDifferenceHoursAndMinutes(timeDifferenceInMinutes: number): TimeDifference {
|
||||||
let offsetHours = Math.trunc(Math.abs(timeDifferenceInMinutes) / 60);
|
const offsetHours = Math.trunc(Math.abs(timeDifferenceInMinutes) / 60);
|
||||||
let offsetMinutes = Math.abs(timeDifferenceInMinutes) - offsetHours * 60;
|
const offsetMinutes = Math.abs(timeDifferenceInMinutes) - offsetHours * 60;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
offsetHours: offsetHours,
|
offsetHours: offsetHours,
|
||||||
@@ -228,24 +259,24 @@ export function getTimeDifferenceHoursAndMinutes(timeDifferenceInMinutes) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMinuteFirstUnixTime(date) {
|
export function getMinuteFirstUnixTime(date: SupportedDate): number {
|
||||||
const datetime = moment(date);
|
const datetime = moment(date);
|
||||||
return datetime.set({ second: 0, millisecond: 0 }).unix();
|
return datetime.set({ second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMinuteLastUnixTime(date) {
|
export function getMinuteLastUnixTime(date: SupportedDate): number {
|
||||||
return moment.unix(getMinuteFirstUnixTime(date)).add(1, 'minutes').subtract(1, 'seconds').unix();
|
return moment.unix(getMinuteFirstUnixTime(date)).add(1, 'minutes').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTodayFirstUnixTime() {
|
export function getTodayFirstUnixTime(): number {
|
||||||
return moment().set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
return moment().set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTodayLastUnixTime() {
|
export function getTodayLastUnixTime(): number {
|
||||||
return moment.unix(getTodayFirstUnixTime()).add(1, 'days').subtract(1, 'seconds').unix();
|
return moment.unix(getTodayFirstUnixTime()).add(1, 'days').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisWeekFirstUnixTime(firstDayOfWeek) {
|
export function getThisWeekFirstUnixTime(firstDayOfWeek: number): number {
|
||||||
const today = moment.unix(getTodayFirstUnixTime());
|
const today = moment.unix(getTodayFirstUnixTime());
|
||||||
|
|
||||||
if (!isNumber(firstDayOfWeek)) {
|
if (!isNumber(firstDayOfWeek)) {
|
||||||
@@ -261,122 +292,143 @@ export function getThisWeekFirstUnixTime(firstDayOfWeek) {
|
|||||||
return today.subtract(dayOfWeek, 'days').unix();
|
return today.subtract(dayOfWeek, 'days').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisWeekLastUnixTime(firstDayOfWeek) {
|
export function getThisWeekLastUnixTime(firstDayOfWeek: number): number {
|
||||||
return moment.unix(getThisWeekFirstUnixTime(firstDayOfWeek)).add(7, 'days').subtract(1, 'seconds').unix();
|
return moment.unix(getThisWeekFirstUnixTime(firstDayOfWeek)).add(7, 'days').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisMonthFirstUnixTime() {
|
export function getThisMonthFirstUnixTime(): number {
|
||||||
const today = moment.unix(getTodayFirstUnixTime());
|
const today = moment.unix(getTodayFirstUnixTime());
|
||||||
return today.subtract(today.date() - 1, 'days').unix();
|
return today.subtract(today.date() - 1, 'days').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisMonthLastUnixTime() {
|
export function getThisMonthLastUnixTime(): number {
|
||||||
return moment.unix(getThisMonthFirstUnixTime()).add(1, 'months').subtract(1, 'seconds').unix();
|
return moment.unix(getThisMonthFirstUnixTime()).add(1, 'months').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisMonthSpecifiedDayFirstUnixTime(date) {
|
export function getThisMonthSpecifiedDayFirstUnixTime(date: number): number {
|
||||||
return moment().set({ date: date, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
return moment().set({ date: date, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisMonthSpecifiedDayLastUnixTime(date) {
|
export function getThisMonthSpecifiedDayLastUnixTime(date: number): number {
|
||||||
return moment.unix(getThisMonthSpecifiedDayFirstUnixTime(date)).add(1, 'days').subtract(1, 'seconds').unix();
|
return moment.unix(getThisMonthSpecifiedDayFirstUnixTime(date)).add(1, 'days').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisYearFirstUnixTime() {
|
export function getThisYearFirstUnixTime(): number {
|
||||||
const today = moment.unix(getTodayFirstUnixTime());
|
const today = moment.unix(getTodayFirstUnixTime());
|
||||||
return today.subtract(today.dayOfYear() - 1, 'days').unix();
|
return today.subtract(today.dayOfYear() - 1, 'days').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThisYearLastUnixTime() {
|
export function getThisYearLastUnixTime(): number {
|
||||||
return moment.unix(getThisYearFirstUnixTime()).add(1, 'years').subtract(1, 'seconds').unix();
|
return moment.unix(getThisYearFirstUnixTime()).add(1, 'years').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSpecifiedDayFirstUnixTime(unixTime) {
|
export function getSpecifiedDayFirstUnixTime(unixTime: number): number {
|
||||||
return moment.unix(unixTime).set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
return moment.unix(unixTime).set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearFirstUnixTime(year) {
|
export function getYearFirstUnixTime(year: number): number {
|
||||||
return moment().set({ year: year, month: 0, date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
return moment().set({ year: year, month: 0, date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearLastUnixTime(year) {
|
export function getYearLastUnixTime(year: number): number {
|
||||||
return moment.unix(getYearFirstUnixTime(year)).add(1, 'years').subtract(1, 'seconds').unix();
|
return moment.unix(getYearFirstUnixTime(year)).add(1, 'years').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getQuarterFirstUnixTime(yearQuarter) {
|
export function getQuarterFirstUnixTime(yearQuarter: YearQuarter): number {
|
||||||
return moment().set({ year: yearQuarter.year, month: (yearQuarter.quarter - 1) * 3, date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
return moment().set({ year: yearQuarter.year, month: (yearQuarter.quarter - 1) * 3, date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getQuarterLastUnixTime(yearQuarter) {
|
export function getQuarterLastUnixTime(yearQuarter: YearQuarter): number {
|
||||||
return moment.unix(getQuarterFirstUnixTime(yearQuarter)).add(3, 'months').subtract(1, 'seconds').unix();
|
return moment.unix(getQuarterFirstUnixTime(yearQuarter)).add(3, 'months').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearMonthFirstUnixTime(yearMonth) {
|
export function getYearMonthFirstUnixTime(yearMonth: YearMonth | string): number {
|
||||||
|
let yearMonthObj: YearMonth | null = null;
|
||||||
|
|
||||||
if (isString(yearMonth)) {
|
if (isString(yearMonth)) {
|
||||||
yearMonth = getYearMonthObjectFromString(yearMonth);
|
yearMonthObj = getYearMonthObjectFromString(yearMonth as string);
|
||||||
} else if (isObject(yearMonth) && !isYearMonthValid(yearMonth.year, yearMonth.month)) {
|
} else if (isObject(yearMonth) && !isYearMonthValid((yearMonth as YearMonth).year, (yearMonth as YearMonth).month)) {
|
||||||
yearMonth = null;
|
yearMonthObj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!yearMonth) {
|
if (!yearMonthObj) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return moment().set({ year: yearMonth.year, month: yearMonth.month, date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
return moment().set({ year: yearMonthObj.year, month: yearMonthObj.month, date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }).unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getYearMonthLastUnixTime(yearMonth) {
|
export function getYearMonthLastUnixTime(yearMonth: YearMonth | string): number {
|
||||||
return moment.unix(getYearMonthFirstUnixTime(yearMonth)).add(1, 'months').subtract(1, 'seconds').unix();
|
return moment.unix(getYearMonthFirstUnixTime(yearMonth)).add(1, 'months').subtract(1, 'seconds').unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllYearsStartAndEndUnixTimes(startYearMonth, endYearMonth) {
|
export function getStartEndYearMonthRange(startYearMonth: YearMonth | string, endYearMonth: YearMonth | string): YearMonthRange | null {
|
||||||
|
let startYearMonthObj: YearMonth | null = null;
|
||||||
|
let endYearMonthObj: YearMonth | null = null;
|
||||||
|
|
||||||
if (isString(startYearMonth)) {
|
if (isString(startYearMonth)) {
|
||||||
startYearMonth = getYearMonthObjectFromString(startYearMonth);
|
startYearMonthObj = getYearMonthObjectFromString(startYearMonth as string);
|
||||||
|
} else if (isObject(startYearMonth)) {
|
||||||
|
startYearMonthObj = startYearMonth as YearMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isString(endYearMonth)) {
|
if (isString(endYearMonth)) {
|
||||||
endYearMonth = getYearMonthObjectFromString(endYearMonth);
|
endYearMonthObj = getYearMonthObjectFromString(endYearMonth as string);
|
||||||
|
} else {
|
||||||
|
endYearMonthObj = endYearMonth as YearMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
const allYearTimes = [];
|
if (!startYearMonthObj || !endYearMonthObj) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
for (let year = startYearMonth.year; year <= endYearMonth.year; year++) {
|
return {
|
||||||
const yearTime = {
|
startYearMonth: startYearMonthObj,
|
||||||
year: year
|
endYearMonth: endYearMonthObj
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAllYearsStartAndEndUnixTimes(startYearMonth: YearMonth | string, endYearMonth: YearMonth | string): YearUnixTime[] {
|
||||||
|
const allYearTimes: YearUnixTime[] = [];
|
||||||
|
const range = getStartEndYearMonthRange(startYearMonth, endYearMonth);
|
||||||
|
|
||||||
|
if (!range) {
|
||||||
|
return allYearTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let year = range.startYearMonth.year; year <= range.endYearMonth.year; year++) {
|
||||||
|
const yearTime: YearUnixTime = {
|
||||||
|
year: year,
|
||||||
|
minUnixTime: getYearFirstUnixTime(year),
|
||||||
|
maxUnixTime: getYearLastUnixTime(year),
|
||||||
};
|
};
|
||||||
|
|
||||||
yearTime.minUnixTime = getYearFirstUnixTime(year);
|
|
||||||
yearTime.maxUnixTime = getYearLastUnixTime(year);
|
|
||||||
|
|
||||||
allYearTimes.push(yearTime);
|
allYearTimes.push(yearTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return allYearTimes;
|
return allYearTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllQuartersStartAndEndUnixTimes(startYearMonth, endYearMonth) {
|
export function getAllQuartersStartAndEndUnixTimes(startYearMonth: YearMonth | string, endYearMonth: YearMonth | string): YearQuarterUnixTime[] {
|
||||||
if (isString(startYearMonth)) {
|
const allYearQuarterTimes: YearQuarterUnixTime[] = [];
|
||||||
startYearMonth = getYearMonthObjectFromString(startYearMonth);
|
const range = getStartEndYearMonthRange(startYearMonth, endYearMonth);
|
||||||
|
|
||||||
|
if (!range) {
|
||||||
|
return allYearQuarterTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isString(endYearMonth)) {
|
for (let year = range.startYearMonth.year, month = range.startYearMonth.month; year < range.endYearMonth.year || (year === range.endYearMonth.year && ((month / 3) <= (range.endYearMonth.month / 3))); ) {
|
||||||
endYearMonth = getYearMonthObjectFromString(endYearMonth);
|
const yearQuarter: YearQuarter = {
|
||||||
}
|
|
||||||
|
|
||||||
const allYearQuarterTimes = [];
|
|
||||||
|
|
||||||
for (let year = startYearMonth.year, month = startYearMonth.month; year < endYearMonth.year || (year === endYearMonth.year && ((month / 3) <= (endYearMonth.month / 3))); ) {
|
|
||||||
const yearQuarterTime = {
|
|
||||||
year: year,
|
year: year,
|
||||||
quarter: Math.floor((month / 3)) + 1
|
quarter: Math.floor((month / 3)) + 1
|
||||||
};
|
};
|
||||||
|
|
||||||
yearQuarterTime.minUnixTime = getQuarterFirstUnixTime(yearQuarterTime);
|
const minUnixTime = getQuarterFirstUnixTime(yearQuarter);
|
||||||
yearQuarterTime.maxUnixTime = getQuarterLastUnixTime(yearQuarterTime);
|
const maxUnixTime = getQuarterLastUnixTime(yearQuarter);
|
||||||
|
|
||||||
allYearQuarterTimes.push(yearQuarterTime);
|
allYearQuarterTimes.push(YearQuarterUnixTime.of(yearQuarter, minUnixTime, maxUnixTime));
|
||||||
|
|
||||||
if (year === endYearMonth.year && month >= endYearMonth.month) {
|
if (year === range.endYearMonth.year && month >= range.endYearMonth.month) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,29 +443,26 @@ export function getAllQuartersStartAndEndUnixTimes(startYearMonth, endYearMonth)
|
|||||||
return allYearQuarterTimes;
|
return allYearQuarterTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllMonthsStartAndEndUnixTimes(startYearMonth, endYearMonth) {
|
export function getAllMonthsStartAndEndUnixTimes(startYearMonth: YearMonth | string, endYearMonth: YearMonth | string): YearMonthUnixTime[] {
|
||||||
if (isString(startYearMonth)) {
|
const allYearMonthTimes: YearMonthUnixTime[] = [];
|
||||||
startYearMonth = getYearMonthObjectFromString(startYearMonth);
|
const range = getStartEndYearMonthRange(startYearMonth, endYearMonth);
|
||||||
|
|
||||||
|
if (!range) {
|
||||||
|
return allYearMonthTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isString(endYearMonth)) {
|
for (let year = range.startYearMonth.year, month = range.startYearMonth.month; year <= range.endYearMonth.year || month <= range.endYearMonth.month; ) {
|
||||||
endYearMonth = getYearMonthObjectFromString(endYearMonth);
|
const yearMonth: YearMonth = {
|
||||||
}
|
|
||||||
|
|
||||||
const allYearMonthTimes = [];
|
|
||||||
|
|
||||||
for (let year = startYearMonth.year, month = startYearMonth.month; year <= endYearMonth.year || month <= endYearMonth.month; ) {
|
|
||||||
const yearMonthTime = {
|
|
||||||
year: year,
|
year: year,
|
||||||
month: month
|
month: month
|
||||||
};
|
};
|
||||||
|
|
||||||
yearMonthTime.minUnixTime = getYearMonthFirstUnixTime(yearMonthTime);
|
const minUnixTime = getYearMonthFirstUnixTime(yearMonth);
|
||||||
yearMonthTime.maxUnixTime = getYearMonthLastUnixTime(yearMonthTime);
|
const maxUnixTime = getYearMonthLastUnixTime(yearMonth);
|
||||||
|
|
||||||
allYearMonthTimes.push(yearMonthTime);
|
allYearMonthTimes.push(YearMonthUnixTime.of(yearMonth, minUnixTime, maxUnixTime));
|
||||||
|
|
||||||
if (year === endYearMonth.year && month === endYearMonth.month) {
|
if (year === range.endYearMonth.year && month === range.endYearMonth.month) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +477,7 @@ export function getAllMonthsStartAndEndUnixTimes(startYearMonth, endYearMonth) {
|
|||||||
return allYearMonthTimes;
|
return allYearMonthTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDateTimeFormatType(allFormatMap, allFormatArray, localeDefaultFormatTypeName, systemDefaultFormatType, formatTypeValue) {
|
export function getDateTimeFormatType(allFormatMap: AllDateTimeFormatMap, allFormatArray: AllDateTimeFormatArray, localeDefaultFormatTypeName: string, systemDefaultFormatType: AllDateTimeFormatType, formatTypeValue: number): AllDateTimeFormatType {
|
||||||
if (formatTypeValue > LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE && allFormatArray[formatTypeValue - 1] && allFormatArray[formatTypeValue - 1].key) {
|
if (formatTypeValue > LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE && allFormatArray[formatTypeValue - 1] && allFormatArray[formatTypeValue - 1].key) {
|
||||||
return allFormatArray[formatTypeValue - 1];
|
return allFormatArray[formatTypeValue - 1];
|
||||||
} else if (formatTypeValue === LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE && allFormatMap[localeDefaultFormatTypeName] && allFormatMap[localeDefaultFormatTypeName].key) {
|
} else if (formatTypeValue === LANGUAGE_DEFAULT_DATE_TIME_FORMAT_VALUE && allFormatMap[localeDefaultFormatTypeName] && allFormatMap[localeDefaultFormatTypeName].key) {
|
||||||
@@ -438,7 +487,7 @@ export function getDateTimeFormatType(allFormatMap, allFormatArray, localeDefaul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getShiftedDateRange(minTime, maxTime, scale) {
|
export function getShiftedDateRange(minTime: number, maxTime: number, scale: number): TimeRange {
|
||||||
const minDateTime = parseDateFromUnixTime(minTime).set({ millisecond: 0 });
|
const minDateTime = parseDateFromUnixTime(minTime).set({ millisecond: 0 });
|
||||||
const maxDateTime = parseDateFromUnixTime(maxTime).set({ millisecond: 999 });
|
const maxDateTime = parseDateFromUnixTime(maxTime).set({ millisecond: 999 });
|
||||||
|
|
||||||
@@ -477,7 +526,7 @@ export function getShiftedDateRange(minTime, maxTime, scale) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getShiftedDateRangeAndDateType(minTime, maxTime, scale, firstDayOfWeek, scene) {
|
export function getShiftedDateRangeAndDateType(minTime: number, maxTime: number, scale: number, firstDayOfWeek: number, scene: DateRangeScene): TimeRangeAndDateType {
|
||||||
const newDateRange = getShiftedDateRange(minTime, maxTime, scale);
|
const newDateRange = getShiftedDateRange(minTime, maxTime, scale);
|
||||||
const newDateType = getDateTypeByDateRange(newDateRange.minTime, newDateRange.maxTime, firstDayOfWeek, scene);
|
const newDateType = getDateTypeByDateRange(newDateRange.minTime, newDateRange.maxTime, firstDayOfWeek, scene);
|
||||||
|
|
||||||
@@ -488,7 +537,7 @@ export function getShiftedDateRangeAndDateType(minTime, maxTime, scale, firstDay
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getShiftedDateRangeAndDateTypeForBillingCycle(minTime, maxTime, scale, firstDayOfWeek, scene, statementDate) {
|
export function getShiftedDateRangeAndDateTypeForBillingCycle(minTime: number, maxTime: number, scale: number, firstDayOfWeek: number, scene: number, statementDate: number): TimeRangeAndDateType | null {
|
||||||
if (!statementDate || !DateRange.PreviousBillingCycle.isAvailableForScene(scene) || !DateRange.CurrentBillingCycle.isAvailableForScene(scene)) {
|
if (!statementDate || !DateRange.PreviousBillingCycle.isAvailableForScene(scene) || !DateRange.CurrentBillingCycle.isAvailableForScene(scene)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -509,7 +558,7 @@ export function getShiftedDateRangeAndDateTypeForBillingCycle(minTime, maxTime,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek, scene) {
|
export function getDateTypeByDateRange(minTime: number, maxTime: number, firstDayOfWeek: number, scene: DateRangeScene): number {
|
||||||
const allDateRanges = DateRange.values();
|
const allDateRanges = DateRange.values();
|
||||||
let newDateType = DateRange.Custom.type;
|
let newDateType = DateRange.Custom.type;
|
||||||
|
|
||||||
@@ -531,7 +580,7 @@ export function getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek, scene)
|
|||||||
return newDateType;
|
return newDateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDateTypeByBillingCycleDateRange(minTime, maxTime, firstDayOfWeek, scene, statementDate) {
|
export function getDateTypeByBillingCycleDateRange(minTime: number, maxTime: number, firstDayOfWeek: number, scene: DateRangeScene, statementDate: number): number | null {
|
||||||
if (!statementDate || !DateRange.PreviousBillingCycle.isAvailableForScene(scene) || !DateRange.CurrentBillingCycle.isAvailableForScene(scene)) {
|
if (!statementDate || !DateRange.PreviousBillingCycle.isAvailableForScene(scene) || !DateRange.CurrentBillingCycle.isAvailableForScene(scene)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -548,7 +597,7 @@ export function getDateTypeByBillingCycleDateRange(minTime, maxTime, firstDayOfW
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDateRangeByDateType(dateType, firstDayOfWeek) {
|
export function getDateRangeByDateType(dateType: number, firstDayOfWeek: number): TimeRangeAndDateType | null {
|
||||||
let maxTime = 0;
|
let maxTime = 0;
|
||||||
let minTime = 0;
|
let minTime = 0;
|
||||||
|
|
||||||
@@ -614,7 +663,7 @@ export function getDateRangeByDateType(dateType, firstDayOfWeek) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDateRangeByBillingCycleDateType(dateType, firstDayOfWeek, statementDate) {
|
export function getDateRangeByBillingCycleDateType(dateType: number, firstDayOfWeek: number, statementDate: number): TimeRangeAndDateType | null {
|
||||||
let maxTime = 0;
|
let maxTime = 0;
|
||||||
let minTime = 0;
|
let minTime = 0;
|
||||||
|
|
||||||
@@ -657,8 +706,8 @@ export function getDateRangeByBillingCycleDateType(dateType, firstDayOfWeek, sta
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRecentMonthDateRanges(monthCount) {
|
export function getRecentMonthDateRanges(monthCount: number): RecentMonthDateRange[] {
|
||||||
const recentDateRanges = [];
|
const recentDateRanges: RecentMonthDateRange[] = [];
|
||||||
const thisMonthFirstUnixTime = getThisMonthFirstUnixTime();
|
const thisMonthFirstUnixTime = getThisMonthFirstUnixTime();
|
||||||
|
|
||||||
for (let i = 0; i < monthCount; i++) {
|
for (let i = 0; i < monthCount; i++) {
|
||||||
@@ -668,10 +717,10 @@ export function getRecentMonthDateRanges(monthCount) {
|
|||||||
minTime = getUnixTimeBeforeUnixTime(thisMonthFirstUnixTime, i, 'months');
|
minTime = getUnixTimeBeforeUnixTime(thisMonthFirstUnixTime, i, 'months');
|
||||||
}
|
}
|
||||||
|
|
||||||
let maxTime = getUnixTimeBeforeUnixTime(getUnixTimeAfterUnixTime(minTime, 1, 'months'), 1, 'seconds');
|
const maxTime = getUnixTimeBeforeUnixTime(getUnixTimeAfterUnixTime(minTime, 1, 'months'), 1, 'seconds');
|
||||||
let dateType = DateRange.Custom.type;
|
let dateType = DateRange.Custom.type;
|
||||||
let year = getYear(parseDateFromUnixTime(minTime));
|
const year = getYear(parseDateFromUnixTime(minTime));
|
||||||
let month = getMonth(parseDateFromUnixTime(minTime));
|
const month = getMonth(parseDateFromUnixTime(minTime));
|
||||||
|
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
dateType = DateRange.ThisMonth.type;
|
dateType = DateRange.ThisMonth.type;
|
||||||
@@ -691,7 +740,7 @@ export function getRecentMonthDateRanges(monthCount) {
|
|||||||
return recentDateRanges;
|
return recentDateRanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRecentDateRangeTypeByDateType(allRecentMonthDateRanges, dateType) {
|
export function getRecentDateRangeTypeByDateType(allRecentMonthDateRanges: LocalizedRecentMonthDateRange[], dateType: number): number {
|
||||||
for (let i = 0; i < allRecentMonthDateRanges.length; i++) {
|
for (let i = 0; i < allRecentMonthDateRanges.length; i++) {
|
||||||
if (!allRecentMonthDateRanges[i].isPreset && allRecentMonthDateRanges[i].dateType === dateType) {
|
if (!allRecentMonthDateRanges[i].isPreset && allRecentMonthDateRanges[i].dateType === dateType) {
|
||||||
return i;
|
return i;
|
||||||
@@ -701,7 +750,7 @@ export function getRecentDateRangeTypeByDateType(allRecentMonthDateRanges, dateT
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRecentDateRangeType(allRecentMonthDateRanges, dateType, minTime, maxTime, firstDayOfWeek) {
|
export function getRecentDateRangeType(allRecentMonthDateRanges: LocalizedRecentMonthDateRange[], dateType: number, minTime: number, maxTime: number, firstDayOfWeek: number): number {
|
||||||
let dateRange = getDateRangeByDateType(dateType, firstDayOfWeek);
|
let dateRange = getDateRangeByDateType(dateType, firstDayOfWeek);
|
||||||
|
|
||||||
if (dateRange && dateRange.dateType === DateRange.All.type) {
|
if (dateRange && dateRange.dateType === DateRange.All.type) {
|
||||||
@@ -731,7 +780,7 @@ export function getRecentDateRangeType(allRecentMonthDateRanges, dateType, minTi
|
|||||||
return getRecentDateRangeTypeByDateType(allRecentMonthDateRanges, DateRange.Custom.type);
|
return getRecentDateRangeTypeByDateType(allRecentMonthDateRanges, DateRange.Custom.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTimeValues(date, is24Hour, isMeridiemIndicatorFirst) {
|
export function getTimeValues(date: Date, is24Hour: boolean, isMeridiemIndicatorFirst: boolean): string[] {
|
||||||
const hourMinuteSeconds = [
|
const hourMinuteSeconds = [
|
||||||
getTwoDigitsString(is24Hour ? date.getHours() : getHourIn12HourFormat(date.getHours())),
|
getTwoDigitsString(is24Hour ? date.getHours() : getHourIn12HourFormat(date.getHours())),
|
||||||
getTwoDigitsString(date.getMinutes()),
|
getTwoDigitsString(date.getMinutes()),
|
||||||
@@ -747,8 +796,8 @@ export function getTimeValues(date, is24Hour, isMeridiemIndicatorFirst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCombinedDateAndTimeValues(date, timeValues, is24Hour, isMeridiemIndicatorFirst) {
|
export function getCombinedDateAndTimeValues(date: Date, timeValues: string[], is24Hour: boolean, isMeridiemIndicatorFirst: boolean): Date {
|
||||||
let newDateTime = new Date(date.valueOf());
|
const newDateTime = new Date(date.valueOf());
|
||||||
let hours = 0;
|
let hours = 0;
|
||||||
let minutes = 0;
|
let minutes = 0;
|
||||||
let seconds = 0;
|
let seconds = 0;
|
||||||
@@ -788,7 +837,7 @@ export function getCombinedDateAndTimeValues(date, timeValues, is24Hour, isMerid
|
|||||||
return newDateTime;
|
return newDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDateRangeMatchFullYears(minTime, maxTime) {
|
export function isDateRangeMatchFullYears(minTime: number, maxTime: number): boolean {
|
||||||
const minDateTime = parseDateFromUnixTime(minTime).set({ millisecond: 0 });
|
const minDateTime = parseDateFromUnixTime(minTime).set({ millisecond: 0 });
|
||||||
const maxDateTime = parseDateFromUnixTime(maxTime).set({ millisecond: 999 });
|
const maxDateTime = parseDateFromUnixTime(maxTime).set({ millisecond: 999 });
|
||||||
|
|
||||||
@@ -798,7 +847,7 @@ export function isDateRangeMatchFullYears(minTime, maxTime) {
|
|||||||
return firstDayOfYear.unix() === minDateTime.unix() && lastDayOfYear.unix() === maxDateTime.unix();
|
return firstDayOfYear.unix() === minDateTime.unix() && lastDayOfYear.unix() === maxDateTime.unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDateRangeMatchFullMonths(minTime, maxTime) {
|
export function isDateRangeMatchFullMonths(minTime: number, maxTime: number): boolean {
|
||||||
const minDateTime = parseDateFromUnixTime(minTime).set({ millisecond: 0 });
|
const minDateTime = parseDateFromUnixTime(minTime).set({ millisecond: 0 });
|
||||||
const maxDateTime = parseDateFromUnixTime(maxTime).set({ millisecond: 999 });
|
const maxDateTime = parseDateFromUnixTime(maxTime).set({ millisecond: 999 });
|
||||||
|
|
||||||
@@ -808,7 +857,7 @@ export function isDateRangeMatchFullMonths(minTime, maxTime) {
|
|||||||
return firstDayOfMonth.unix() === minDateTime.unix() && lastDayOfMonth.unix() === maxDateTime.unix();
|
return firstDayOfMonth.unix() === minDateTime.unix() && lastDayOfMonth.unix() === maxDateTime.unix();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDateRangeMatchOneMonth(minTime, maxTime) {
|
export function isDateRangeMatchOneMonth(minTime: number, maxTime: number): boolean {
|
||||||
const minDateTime = parseDateFromUnixTime(minTime);
|
const minDateTime = parseDateFromUnixTime(minTime);
|
||||||
const maxDateTime = parseDateFromUnixTime(maxTime);
|
const maxDateTime = parseDateFromUnixTime(maxTime);
|
||||||
|
|
||||||
+5
-5
@@ -43,7 +43,7 @@ import {
|
|||||||
getRecentMonthDateRanges,
|
getRecentMonthDateRanges,
|
||||||
isDateRangeMatchFullYears,
|
isDateRangeMatchFullYears,
|
||||||
isDateRangeMatchFullMonths
|
isDateRangeMatchFullMonths
|
||||||
} from './datetime.js';
|
} from './datetime.ts';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
appendDigitGroupingSymbol,
|
appendDigitGroupingSymbol,
|
||||||
@@ -489,25 +489,25 @@ function formatYearQuarter(translateFn, year, quarter) {
|
|||||||
|
|
||||||
function isLongTime24HourFormat(translateFn, formatTypeValue) {
|
function isLongTime24HourFormat(translateFn, formatTypeValue) {
|
||||||
const defaultLongTimeFormatTypeName = translateFn('default.longTimeFormat');
|
const defaultLongTimeFormatTypeName = translateFn('default.longTimeFormat');
|
||||||
const type = getDateTimeFormatType(LongTimeFormat.values(), LongTimeFormat.values(), defaultLongTimeFormatTypeName, LongTimeFormat.Default, formatTypeValue);
|
const type = getDateTimeFormatType(LongTimeFormat.all(), LongTimeFormat.values(), defaultLongTimeFormatTypeName, LongTimeFormat.Default, formatTypeValue);
|
||||||
return type.is24HourFormat;
|
return type.is24HourFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLongTimeMeridiemIndicatorFirst(translateFn, formatTypeValue) {
|
function isLongTimeMeridiemIndicatorFirst(translateFn, formatTypeValue) {
|
||||||
const defaultLongTimeFormatTypeName = translateFn('default.longTimeFormat');
|
const defaultLongTimeFormatTypeName = translateFn('default.longTimeFormat');
|
||||||
const type = getDateTimeFormatType(LongTimeFormat.values(), LongTimeFormat.values(), defaultLongTimeFormatTypeName, LongTimeFormat.Default, formatTypeValue);
|
const type = getDateTimeFormatType(LongTimeFormat.all(), LongTimeFormat.values(), defaultLongTimeFormatTypeName, LongTimeFormat.Default, formatTypeValue);
|
||||||
return type.isMeridiemIndicatorFirst;
|
return type.isMeridiemIndicatorFirst;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isShortTime24HourFormat(translateFn, formatTypeValue) {
|
function isShortTime24HourFormat(translateFn, formatTypeValue) {
|
||||||
const defaultShortTimeFormatTypeName = translateFn('default.shortTimeFormat');
|
const defaultShortTimeFormatTypeName = translateFn('default.shortTimeFormat');
|
||||||
const type = getDateTimeFormatType(ShortTimeFormat.values(), ShortTimeFormat.values(), defaultShortTimeFormatTypeName, ShortTimeFormat.Default, formatTypeValue);
|
const type = getDateTimeFormatType(ShortTimeFormat.all(), ShortTimeFormat.values(), defaultShortTimeFormatTypeName, ShortTimeFormat.Default, formatTypeValue);
|
||||||
return type.is24HourFormat;
|
return type.is24HourFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isShortTimeMeridiemIndicatorFirst(translateFn, formatTypeValue) {
|
function isShortTimeMeridiemIndicatorFirst(translateFn, formatTypeValue) {
|
||||||
const defaultShortTimeFormatTypeName = translateFn('default.shortTimeFormat');
|
const defaultShortTimeFormatTypeName = translateFn('default.shortTimeFormat');
|
||||||
const type = getDateTimeFormatType(ShortTimeFormat.values(), ShortTimeFormat.values(), defaultShortTimeFormatTypeName, ShortTimeFormat.Default, formatTypeValue);
|
const type = getDateTimeFormatType(ShortTimeFormat.all(), ShortTimeFormat.values(), defaultShortTimeFormatTypeName, ShortTimeFormat.Default, formatTypeValue);
|
||||||
return type.isMeridiemIndicatorFirst;
|
return type.isMeridiemIndicatorFirst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ import {
|
|||||||
getAmapApplicationKey,
|
getAmapApplicationKey,
|
||||||
getExchangeRatesRequestTimeout
|
getExchangeRatesRequestTimeout
|
||||||
} from './server_settings.ts';
|
} from './server_settings.ts';
|
||||||
import { getTimezoneOffsetMinutes } from './datetime.js';
|
import { getTimezoneOffsetMinutes } from './datetime.ts';
|
||||||
import { generateRandomUUID } from './misc.ts';
|
import { generateRandomUUID } from './misc.ts';
|
||||||
|
|
||||||
let needBlockRequest = false;
|
let needBlockRequest = false;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
getAllMonthsStartAndEndUnixTimes,
|
getAllMonthsStartAndEndUnixTimes,
|
||||||
getAllQuartersStartAndEndUnixTimes,
|
getAllQuartersStartAndEndUnixTimes,
|
||||||
getAllYearsStartAndEndUnixTimes
|
getAllYearsStartAndEndUnixTimes
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export function isChartDataTypeAvailableForAnalysisType(chartDataType, analysisType) {
|
export function isChartDataTypeAvailableForAnalysisType(chartDataType, analysisType) {
|
||||||
for (const dataTypeField in statisticsConstants.allChartDataTypes) {
|
for (const dataTypeField in statisticsConstants.allChartDataTypes) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
getBrowserTimezoneOffsetMinutes,
|
getBrowserTimezoneOffsetMinutes,
|
||||||
getDummyUnixTimeForLocalUsage
|
getDummyUnixTimeForLocalUsage
|
||||||
} from './datetime.js';
|
} from './datetime.ts';
|
||||||
import {
|
import {
|
||||||
categoryTypeToTransactionType,
|
categoryTypeToTransactionType,
|
||||||
isSubCategoryIdAvailable,
|
isSubCategoryIdAvailable,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { DEFAULT_ACCOUNT_COLOR } from '@/consts/color.ts';
|
|||||||
import services from '@/lib/services.js';
|
import services from '@/lib/services.js';
|
||||||
import logger from '@/lib/logger.js';
|
import logger from '@/lib/logger.js';
|
||||||
import { isNumber, isEquals } from '@/lib/common.ts';
|
import { isNumber, isEquals } from '@/lib/common.ts';
|
||||||
import { getCurrentUnixTime } from '@/lib/datetime.js';
|
import { getCurrentUnixTime } from '@/lib/datetime.ts';
|
||||||
import { getCategorizedAccountsMap, getAllFilteredAccountsBalance } from '@/lib/account.js';
|
import { getCategorizedAccountsMap, getAllFilteredAccountsBalance } from '@/lib/account.js';
|
||||||
|
|
||||||
function loadAccountList(state, accounts) {
|
function loadAccountList(state, accounts) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { defineStore } from 'pinia';
|
|||||||
import services from '@/lib/services.js';
|
import services from '@/lib/services.js';
|
||||||
import logger from '@/lib/logger.js';
|
import logger from '@/lib/logger.js';
|
||||||
import { isEquals } from '@/lib/common.ts';
|
import { isEquals } from '@/lib/common.ts';
|
||||||
import { getCurrentUnixTime, formatUnixTime } from '@/lib/datetime.js';
|
import { getCurrentUnixTime, formatUnixTime } from '@/lib/datetime.ts';
|
||||||
import { getExchangedAmount } from '@/lib/numeral.js';
|
import { getExchangedAmount } from '@/lib/numeral.js';
|
||||||
|
|
||||||
const exchangeRatesLocalStorageKey = 'ebk_app_exchange_rates';
|
const exchangeRatesLocalStorageKey = 'ebk_app_exchange_rates';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
getThisMonthLastUnixTime,
|
getThisMonthLastUnixTime,
|
||||||
getThisYearFirstUnixTime,
|
getThisYearFirstUnixTime,
|
||||||
getThisYearLastUnixTime
|
getThisYearLastUnixTime
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import services from '@/lib/services.js';
|
import services from '@/lib/services.js';
|
||||||
import logger from '@/lib/logger.js';
|
import logger from '@/lib/logger.js';
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
getYearAndMonthFromUnixTime,
|
getYearAndMonthFromUnixTime,
|
||||||
getDateRangeByDateType
|
getDateRangeByDateType
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import {
|
import {
|
||||||
getFinalAccountIdsByFilteredAccountIds
|
getFinalAccountIdsByFilteredAccountIds
|
||||||
} from '@/lib/account.js';
|
} from '@/lib/account.js';
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import {
|
|||||||
getYearAndMonth,
|
getYearAndMonth,
|
||||||
getDay,
|
getDay,
|
||||||
getDayOfWeekName
|
getDayOfWeekName
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { getAmountWithDecimalNumberCount } from '@/lib/numeral.js';
|
import { getAmountWithDecimalNumberCount } from '@/lib/numeral.js';
|
||||||
import { getCurrencyFraction } from '@/lib/currency.ts';
|
import { getCurrencyFraction } from '@/lib/currency.ts';
|
||||||
import { getFirstAvailableCategoryId } from '@/lib/category.js';
|
import { getFirstAvailableCategoryId } from '@/lib/category.js';
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ import {
|
|||||||
formatUnixTime,
|
formatUnixTime,
|
||||||
getUnixTimeBeforeUnixTime,
|
getUnixTimeBeforeUnixTime,
|
||||||
getUnixTimeAfterUnixTime
|
getUnixTimeAfterUnixTime
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mdiRefresh,
|
mdiRefresh,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import { TransactionType } from '@/core/transaction.ts';
|
|||||||
import {
|
import {
|
||||||
parseDateFromUnixTime,
|
parseDateFromUnixTime,
|
||||||
getMonthName
|
getMonthName
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { getExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
import { getExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ import {
|
|||||||
getShiftedDateRangeAndDateType,
|
getShiftedDateRangeAndDateType,
|
||||||
getDateTypeByDateRange,
|
getDateTypeByDateRange,
|
||||||
getDateRangeByDateType
|
getDateRangeByDateType
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { isChartDataTypeAvailableForAnalysisType } from '@/lib/statistics.js';
|
import { isChartDataTypeAvailableForAnalysisType } from '@/lib/statistics.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ import {
|
|||||||
getDateRangeByBillingCycleDateType,
|
getDateRangeByBillingCycleDateType,
|
||||||
getRecentDateRangeType,
|
getRecentDateRangeType,
|
||||||
isDateRangeMatchOneMonth
|
isDateRangeMatchOneMonth
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import {
|
import {
|
||||||
categoryTypeToTransactionType,
|
categoryTypeToTransactionType,
|
||||||
transactionTypeToCategoryType
|
transactionTypeToCategoryType
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ import {
|
|||||||
getUtcOffsetByUtcOffsetMinutes,
|
getUtcOffsetByUtcOffsetMinutes,
|
||||||
getTimezoneOffsetMinutes,
|
getTimezoneOffsetMinutes,
|
||||||
getCurrentUnixTime
|
getCurrentUnixTime
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||||
import {
|
import {
|
||||||
getTransactionPrimaryCategoryName,
|
getTransactionPrimaryCategoryName,
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ import {
|
|||||||
getUnixTime,
|
getUnixTime,
|
||||||
getUtcOffsetByUtcOffsetMinutes,
|
getUtcOffsetByUtcOffsetMinutes,
|
||||||
getTimezoneOffsetMinutes
|
getTimezoneOffsetMinutes
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import {
|
import {
|
||||||
getTransactionPrimaryCategoryName,
|
getTransactionPrimaryCategoryName,
|
||||||
getTransactionSecondaryCategoryName,
|
getTransactionSecondaryCategoryName,
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ import { useOverviewStore } from '@/stores/overview.js';
|
|||||||
|
|
||||||
import { DateRange } from '@/core/datetime.ts';
|
import { DateRange } from '@/core/datetime.ts';
|
||||||
import { TemplateType } from '@/core/template.ts';
|
import { TemplateType } from '@/core/template.ts';
|
||||||
import { formatUnixTime } from '@/lib/datetime.js';
|
import { formatUnixTime } from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ import {
|
|||||||
getTimezoneOffsetMinutes,
|
getTimezoneOffsetMinutes,
|
||||||
getBrowserTimezoneOffsetMinutes,
|
getBrowserTimezoneOffsetMinutes,
|
||||||
getActualUnixTimeForStore
|
getActualUnixTimeForStore
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ import { useSettingsStore } from '@/stores/setting.js';
|
|||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
|
|
||||||
import { FontSize } from '@/core/font.ts';
|
import { FontSize } from '@/core/font.ts';
|
||||||
import { getCurrentUnixTime, getDay, getDayOfWeekName } from '@/lib/datetime.js';
|
import { getCurrentUnixTime, getDay, getDayOfWeekName } from '@/lib/datetime.ts';
|
||||||
import { setAppFontSize, getFontSizePreviewClassName } from '@/lib/ui/mobile.js';
|
import { setAppFontSize, getFontSizePreviewClassName } from '@/lib/ui/mobile.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ import {
|
|||||||
getShiftedDateRangeAndDateType,
|
getShiftedDateRangeAndDateType,
|
||||||
getDateTypeByDateRange,
|
getDateTypeByDateRange,
|
||||||
getDateRangeByDateType
|
getDateRangeByDateType
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { isChartDataTypeAvailableForAnalysisType } from '@/lib/statistics.js';
|
import { isChartDataTypeAvailableForAnalysisType } from '@/lib/statistics.js';
|
||||||
import { scrollToSelectedItem } from '@/lib/ui/mobile.js';
|
import { scrollToSelectedItem } from '@/lib/ui/mobile.js';
|
||||||
|
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ import {
|
|||||||
getBrowserTimezoneOffsetMinutes,
|
getBrowserTimezoneOffsetMinutes,
|
||||||
getUtcOffsetByUtcOffsetMinutes,
|
getUtcOffsetByUtcOffsetMinutes,
|
||||||
getActualUnixTimeForStore
|
getActualUnixTimeForStore
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||||
import {
|
import {
|
||||||
getTransactionPrimaryCategoryName,
|
getTransactionPrimaryCategoryName,
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ import {
|
|||||||
getDateTypeByBillingCycleDateRange,
|
getDateTypeByBillingCycleDateRange,
|
||||||
getDateRangeByDateType,
|
getDateRangeByDateType,
|
||||||
getDateRangeByBillingCycleDateType
|
getDateRangeByBillingCycleDateType
|
||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.ts';
|
||||||
import { categoryTypeToTransactionType, transactionTypeToCategoryType } from '@/lib/category.js';
|
import { categoryTypeToTransactionType, transactionTypeToCategoryType } from '@/lib/category.js';
|
||||||
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
||||||
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
|
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user