mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
add explicit type for string-based datetimes, replacing third-party datetime type with internal DateTime type
This commit is contained in:
+14
-14
@@ -1,5 +1,5 @@
|
||||
import type { PartialRecord } from '@/core/base.ts';
|
||||
import type { Year1BasedMonth, StartEndTime } from '@/core/datetime.ts';
|
||||
import type { Year1BasedMonth, TextualYearMonthDay, StartEndTime, WeekDay } from '@/core/datetime.ts';
|
||||
import { type Coordinate, getNormalizedCoordinate } from '@/core/coordinate.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
|
||||
@@ -35,9 +35,9 @@ export class Transaction implements TransactionInfoResponse {
|
||||
private _destinationAccount?: Account; // only for displaying transaction
|
||||
private _tags?: TransactionTag[]; // only for displaying transaction
|
||||
|
||||
private _date?: string = undefined; // only for displaying transaction in transaction list
|
||||
private _day?: number = undefined; // only for displaying transaction in transaction list
|
||||
private _dayOfWeek?: string = undefined; // only for displaying transaction in transaction list
|
||||
private _gregorianCalendarYearDashMonthDashDay?: TextualYearMonthDay = undefined; // only for displaying transaction in transaction list
|
||||
private _gregorianCalendarDayOfMonth?: number = undefined; // only for displaying transaction in transaction list
|
||||
private _displayDayOfWeek?: WeekDay = undefined; // only for displaying transaction in transaction list
|
||||
|
||||
protected constructor(id: string, timeSequenceId: string, type: number, categoryId: string, time: number, timeZone: string | undefined, utcOffset: number, sourceAccountId: string, destinationAccountId: string, sourceAmount: number, destinationAmount: number, hideAmount: boolean, tagIds: string[], comment: string, editable: boolean) {
|
||||
this.id = id;
|
||||
@@ -106,16 +106,16 @@ export class Transaction implements TransactionInfoResponse {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public get date(): string | undefined {
|
||||
return this._date;
|
||||
public get gregorianCalendarYearDashMonthDashDay(): TextualYearMonthDay | undefined {
|
||||
return this._gregorianCalendarYearDashMonthDashDay;
|
||||
}
|
||||
|
||||
public get day(): number | undefined {
|
||||
return this._day;
|
||||
public get gregorianCalendarDayOfMonth(): number | undefined {
|
||||
return this._gregorianCalendarDayOfMonth;
|
||||
}
|
||||
|
||||
public get dayOfWeek(): string | undefined {
|
||||
return this._dayOfWeek;
|
||||
public get displayDayOfWeek(): WeekDay | undefined {
|
||||
return this._displayDayOfWeek;
|
||||
}
|
||||
|
||||
public getCategoryId(): string {
|
||||
@@ -220,10 +220,10 @@ export class Transaction implements TransactionInfoResponse {
|
||||
this._geoLocation = undefined;
|
||||
}
|
||||
|
||||
public setDisplayDate(date: string, day: number, dayOfWeek: string): void {
|
||||
this._date = date;
|
||||
this._day = day;
|
||||
this._dayOfWeek = dayOfWeek;
|
||||
public setDisplayDate(gregorianCalendarYearDashMonthDashDay: TextualYearMonthDay, gregorianCalendarDayOfMonth: number, displayDayOfWeek: WeekDay): void {
|
||||
this._gregorianCalendarYearDashMonthDashDay = gregorianCalendarYearDashMonthDashDay;
|
||||
this._gregorianCalendarDayOfMonth = gregorianCalendarDayOfMonth;
|
||||
this._displayDayOfWeek = displayDayOfWeek;
|
||||
}
|
||||
|
||||
public toCreateRequest(clientSessionId: string, actualTime?: number): TransactionCreateRequest {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { type TextualYearMonthDay } from '@/core/datetime.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import { TemplateType } from '@/core/template.ts';
|
||||
|
||||
@@ -8,13 +9,13 @@ export class TransactionTemplate extends Transaction implements TransactionTempl
|
||||
public name: string;
|
||||
public scheduledFrequencyType?: number;
|
||||
public scheduledFrequency?: string;
|
||||
public scheduledStartDate?: string;
|
||||
public scheduledEndDate?: string;
|
||||
public scheduledStartDate?: TextualYearMonthDay;
|
||||
public scheduledEndDate?: TextualYearMonthDay;
|
||||
public scheduledAt?: number;
|
||||
public displayOrder: number;
|
||||
public hidden: boolean;
|
||||
|
||||
private constructor(id: string, templateType: number, name: string, type: number, categoryId: string, timeZone: string | undefined, utcOffset: number, sourceAccountId: string, destinationAccountId: string, sourceAmount: number, destinationAmount: number, hideAmount: boolean, scheduledFrequencyType: number | undefined, scheduledFrequency: string | undefined, scheduledStartDate: string | undefined, scheduledEndDate: string | undefined, scheduledAt: number | undefined, tagIds: string[], comment: string, editable: boolean, displayOrder: number, hidden: boolean) {
|
||||
private constructor(id: string, templateType: number, name: string, type: number, categoryId: string, timeZone: string | undefined, utcOffset: number, sourceAccountId: string, destinationAccountId: string, sourceAmount: number, destinationAmount: number, hideAmount: boolean, scheduledFrequencyType: number | undefined, scheduledFrequency: string | undefined, scheduledStartDate: TextualYearMonthDay | undefined, scheduledEndDate: TextualYearMonthDay | undefined, scheduledAt: number | undefined, tagIds: string[], comment: string, editable: boolean, displayOrder: number, hidden: boolean) {
|
||||
super(id, '', type, categoryId, 0, timeZone, utcOffset, sourceAccountId, destinationAccountId, sourceAmount, destinationAmount, hideAmount, tagIds, comment, editable);
|
||||
this.templateType = templateType;
|
||||
this.name = name;
|
||||
@@ -211,8 +212,8 @@ export interface TransactionTemplateInfoResponse extends TransactionInfoResponse
|
||||
readonly name: string;
|
||||
readonly scheduledFrequencyType?: number;
|
||||
readonly scheduledFrequency?: string;
|
||||
readonly scheduledStartDate?: string;
|
||||
readonly scheduledEndDate?: string;
|
||||
readonly scheduledStartDate?: TextualYearMonthDay;
|
||||
readonly scheduledEndDate?: TextualYearMonthDay;
|
||||
readonly scheduledAt?: number;
|
||||
readonly displayOrder: number;
|
||||
readonly hidden: boolean;
|
||||
|
||||
Reference in New Issue
Block a user