mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
support daily and yearly intervals for scheduled transactions
This commit is contained in:
@@ -24,6 +24,8 @@ const (
|
||||
TRANSACTION_SCHEDULE_FREQUENCY_TYPE_DISABLED TransactionScheduleFrequencyType = 0
|
||||
TRANSACTION_SCHEDULE_FREQUENCY_TYPE_WEEKLY TransactionScheduleFrequencyType = 1
|
||||
TRANSACTION_SCHEDULE_FREQUENCY_TYPE_MONTHLY TransactionScheduleFrequencyType = 2
|
||||
TRANSACTION_SCHEDULE_FREQUENCY_TYPE_DAILY TransactionScheduleFrequencyType = 3
|
||||
TRANSACTION_SCHEDULE_FREQUENCY_TYPE_YEARLY TransactionScheduleFrequencyType = 4
|
||||
)
|
||||
|
||||
// TransactionTemplate represents transaction template stored in database
|
||||
|
||||
@@ -683,7 +683,20 @@ func (s *TransactionService) CreateScheduledTransactions(c core.Context, current
|
||||
|
||||
for i := 0; i < s.UserDataDBCount(); i++ {
|
||||
var templates []*models.TransactionTemplate
|
||||
err := s.UserDataDBByIndex(i).NewSession(c).Where("deleted=? AND template_type=? AND (scheduled_frequency_type=? OR scheduled_frequency_type=?) AND (scheduled_start_time IS NULL OR scheduled_start_time<=?) AND (scheduled_end_time IS NULL OR scheduled_end_time>=?) AND scheduled_at>=? AND scheduled_at<?", false, models.TRANSACTION_TEMPLATE_TYPE_SCHEDULE, models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_WEEKLY, models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_MONTHLY, startTime.Unix(), startTime.Unix(), minScheduledAt, maxScheduledAt).Find(&templates)
|
||||
err := s.UserDataDBByIndex(i).NewSession(c).Where("deleted=?"+
|
||||
" AND template_type=?"+
|
||||
" AND (scheduled_frequency_type=? OR scheduled_frequency_type=? OR scheduled_frequency_type=? OR scheduled_frequency_type=?)"+
|
||||
" AND (scheduled_start_time IS NULL OR scheduled_start_time<=?)"+
|
||||
" AND (scheduled_end_time IS NULL OR scheduled_end_time>=?)"+
|
||||
" AND scheduled_at>=?"+
|
||||
" AND scheduled_at<?",
|
||||
false,
|
||||
models.TRANSACTION_TEMPLATE_TYPE_SCHEDULE,
|
||||
models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_WEEKLY, models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_MONTHLY, models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_DAILY, models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_YEARLY,
|
||||
startTime.Unix(),
|
||||
startTime.Unix(),
|
||||
minScheduledAt,
|
||||
maxScheduledAt).Find(&templates)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -712,7 +725,9 @@ func (s *TransactionService) CreateScheduledTransactions(c core.Context, current
|
||||
}
|
||||
|
||||
if (template.ScheduledFrequencyType != models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_WEEKLY &&
|
||||
template.ScheduledFrequencyType != models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_MONTHLY) ||
|
||||
template.ScheduledFrequencyType != models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_MONTHLY &&
|
||||
template.ScheduledFrequencyType != models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_DAILY &&
|
||||
template.ScheduledFrequencyType != models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_YEARLY) ||
|
||||
template.ScheduledFrequency == "" {
|
||||
skipCount++
|
||||
log.Warnf(c, "[transactions.CreateScheduledTransactions] transaction template \"id:%d\" has invalid scheduled transaction frequency", template.TemplateId)
|
||||
@@ -750,6 +765,10 @@ func (s *TransactionService) CreateScheduledTransactions(c core.Context, current
|
||||
skipCount++
|
||||
log.Infof(c, "[transactions.CreateScheduledTransactions] transaction template \"id:%d\" does not need to create transaction, today is %d of month", template.TemplateId, startTimeInUTC.Day())
|
||||
continue
|
||||
} else if template.ScheduledFrequencyType == models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_YEARLY && !frequencyValueSet[int64(transactionTime.Month())*100+int64(transactionTime.Day())] {
|
||||
skipCount++
|
||||
log.Infof(c, "[transactions.CreateScheduledTransactions] transaction template \"id:%d\" does not need to create transaction, today is %d-%d of year", template.TemplateId, startTimeInUTC.Month(), startTimeInUTC.Day())
|
||||
continue
|
||||
}
|
||||
|
||||
if template.ScheduledStartTime != nil && *template.ScheduledStartTime > transactionUnixTime {
|
||||
|
||||
@@ -4,8 +4,11 @@ import { useI18n } from '@/locales/helpers.ts';
|
||||
|
||||
import { useUserStore } from '@/stores/user.ts';
|
||||
|
||||
import type { TypeAndDisplayName } from '@/core/base.ts';
|
||||
import { type TypeAndDisplayName, itemAndIndex } from '@/core/base.ts';
|
||||
import { type DateTime } from '@/core/datetime.ts';
|
||||
|
||||
import { sortNumbersArray } from '@/lib/common.ts';
|
||||
import { getCurrentDateTime } from '@/lib/datetime.ts';
|
||||
|
||||
export interface CommonScheduleFrequencySelectionProps {
|
||||
type: number;
|
||||
@@ -19,7 +22,8 @@ export function useScheduleFrequencySelectionBase() {
|
||||
const {
|
||||
getAllWeekDays,
|
||||
getAvailableMonthDays,
|
||||
getAllTransactionScheduledFrequencyTypes
|
||||
getAllTransactionScheduledFrequencyTypes,
|
||||
formatDateTimeToLongMonthDay
|
||||
} = useI18n();
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -27,6 +31,33 @@ export function useScheduleFrequencySelectionBase() {
|
||||
const allWeekDays = computed<TypeAndDisplayName[]>(() => getAllWeekDays(userStore.currentUserFirstDayOfWeek));
|
||||
|
||||
const allAvailableMonthDays = computed<TypeAndDisplayName[]>(() => getAvailableMonthDays(28, 3));
|
||||
const allAvailableMonthAndDays = computed<TypeAndDisplayName[]>(() => {
|
||||
const ret: TypeAndDisplayName[] = [];
|
||||
const now: DateTime = getCurrentDateTime();
|
||||
const maxDaysOfMonth: number[] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
||||
|
||||
for (const [days, index] of itemAndIndex(maxDaysOfMonth)) {
|
||||
const month = index + 1;
|
||||
|
||||
for (let day = 1; day <= days; day++) {
|
||||
const dateTime = now.set({
|
||||
month: month,
|
||||
dayOfMonth: day,
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
millisecond: 0
|
||||
});
|
||||
|
||||
ret.push({
|
||||
type: month * 100 + day,
|
||||
displayName: formatDateTimeToLongMonthDay(dateTime)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
||||
function getFrequencyValues(value: string): number[] {
|
||||
const values = value.split(',');
|
||||
@@ -46,6 +77,7 @@ export function useScheduleFrequencySelectionBase() {
|
||||
allTransactionScheduledFrequencyTypes,
|
||||
allWeekDays,
|
||||
allAvailableMonthDays,
|
||||
allAvailableMonthAndDays,
|
||||
// functions
|
||||
getFrequencyValues
|
||||
};
|
||||
|
||||
@@ -28,14 +28,18 @@
|
||||
<v-list v-if="frequencyType === ScheduledTemplateFrequencyType.Disabled.type">
|
||||
<v-list-item :title="tt('None')"></v-list-item>
|
||||
</v-list>
|
||||
<v-list v-if="frequencyType === ScheduledTemplateFrequencyType.Daily.type">
|
||||
<v-list-item :title="tt('Daily')"></v-list-item>
|
||||
</v-list>
|
||||
<v-list select-strategy="classic" v-model:selected="frequencyValue"
|
||||
v-else-if="frequencyType === ScheduledTemplateFrequencyType.Weekly.type">
|
||||
<v-list-item :key="weekDay.type" :value="weekDay.type" :title="weekDay.displayName"
|
||||
:class="{ 'frequency-value-selected v-list-item--active text-primary': isFrequencyValueSelected(weekDay.type) }"
|
||||
v-for="weekDay in allWeekDays">
|
||||
<template #prepend="{ isActive }">
|
||||
<v-checkbox density="compact" class="me-1" :model-value="isActive"
|
||||
@update:model-value="updateFrequencyValue(weekDay.type, $event)"></v-checkbox>
|
||||
<template #prepend="{ isSelected, select }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn density="compact" :model-value="isSelected" @update:model-value="select"></v-checkbox-btn>
|
||||
</v-list-item-action>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -44,9 +48,22 @@
|
||||
<v-list-item :key="monthDay.type" :value="monthDay.type" :title="monthDay.displayName"
|
||||
:class="{ 'frequency-value-selected v-list-item--active text-primary': isFrequencyValueSelected(monthDay.type) }"
|
||||
v-for="monthDay in allAvailableMonthDays">
|
||||
<template #prepend="{ isActive }">
|
||||
<v-checkbox density="compact" class="me-1" :model-value="isActive"
|
||||
@update:model-value="updateFrequencyValue(monthDay.type, $event)"></v-checkbox>
|
||||
<template #prepend="{ isSelected, select }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn density="compact" :model-value="isSelected" @update:model-value="select"></v-checkbox-btn>
|
||||
</v-list-item-action>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-list select-strategy="classic" v-model:selected="frequencyValue"
|
||||
v-else-if="frequencyType === ScheduledTemplateFrequencyType.Yearly.type">
|
||||
<v-list-item :key="monthAndDay.type" :value="monthAndDay.type" :title="monthAndDay.displayName"
|
||||
:class="{ 'frequency-value-selected v-list-item--active text-primary': isFrequencyValueSelected(monthAndDay.type) }"
|
||||
v-for="monthAndDay in allAvailableMonthAndDays">
|
||||
<template #prepend="{ isSelected, select }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn density="compact" :model-value="isSelected" @update:model-value="select"></v-checkbox-btn>
|
||||
</v-list-item-action>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -75,8 +92,19 @@ const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: string): void;
|
||||
}>();
|
||||
|
||||
const { tt, getMultiMonthdayShortNames, getMultiWeekdayLongNames } = useI18n();
|
||||
const { allTransactionScheduledFrequencyTypes, allWeekDays, allAvailableMonthDays, getFrequencyValues } = useScheduleFrequencySelectionBase();
|
||||
const {
|
||||
tt,
|
||||
getMultiMonthAndDayLongNames,
|
||||
getMultiMonthdayShortNames,
|
||||
getMultiWeekdayLongNames
|
||||
} = useI18n();
|
||||
const {
|
||||
allTransactionScheduledFrequencyTypes,
|
||||
allWeekDays,
|
||||
allAvailableMonthDays,
|
||||
allAvailableMonthAndDays,
|
||||
getFrequencyValues
|
||||
} = useScheduleFrequencySelectionBase();
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -92,10 +120,14 @@ const frequencyType = computed<number>({
|
||||
if (props.type !== value) {
|
||||
emit('update:type', value);
|
||||
|
||||
if (value === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
if (value === ScheduledTemplateFrequencyType.Daily.type) {
|
||||
frequencyValue.value = [0];
|
||||
} else if (value === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
frequencyValue.value = [firstDayOfWeek.value];
|
||||
} else if (value === ScheduledTemplateFrequencyType.Monthly.type) {
|
||||
frequencyValue.value = [1];
|
||||
} else if (value === ScheduledTemplateFrequencyType.Yearly.type) {
|
||||
frequencyValue.value = [101];
|
||||
} else {
|
||||
frequencyValue.value = [];
|
||||
}
|
||||
@@ -113,6 +145,8 @@ const frequencyValue = computed<number[]>({
|
||||
const displayFrequency = computed<string>(() => {
|
||||
if (frequencyType.value === ScheduledTemplateFrequencyType.Disabled.type) {
|
||||
return tt('Disabled');
|
||||
} else if (frequencyType.value === ScheduledTemplateFrequencyType.Daily.type) {
|
||||
return tt('Daily');
|
||||
} else if (frequencyType.value === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
if (frequencyValue.value.length) {
|
||||
return tt('format.misc.everyMultiDaysOfWeek', {
|
||||
@@ -129,28 +163,19 @@ const displayFrequency = computed<string>(() => {
|
||||
} else {
|
||||
return tt('Monthly');
|
||||
}
|
||||
} else if (frequencyType.value === ScheduledTemplateFrequencyType.Yearly.type) {
|
||||
if (frequencyValue.value.length) {
|
||||
return tt('format.misc.everyMultiDaysOfYear', {
|
||||
days: getMultiMonthAndDayLongNames(frequencyValue.value)
|
||||
});
|
||||
} else {
|
||||
return tt('Yearly');
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
function updateFrequencyValue(value: number, selected: boolean | null): void {
|
||||
const currentFrequencyValues = frequencyValue.value;
|
||||
const newFrequencyValues: number[] = [];
|
||||
|
||||
for (const currentFrequencyValue of currentFrequencyValues) {
|
||||
if (currentFrequencyValue !== value || selected) {
|
||||
newFrequencyValues.push(currentFrequencyValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
newFrequencyValues.push(value);
|
||||
}
|
||||
|
||||
frequencyValue.value = sortNumbersArray(newFrequencyValues);
|
||||
}
|
||||
|
||||
function isFrequencyValueSelected(currentValue: number): boolean {
|
||||
return frequencyValue.value.indexOf(currentValue) >= 0;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
v-if="currentFrequencyType === ScheduledTemplateFrequencyType.Disabled.type">
|
||||
<f7-list-item :title="tt('None')"></f7-list-item>
|
||||
</f7-list>
|
||||
<f7-list dividers class="schedule-frequency-value-list no-margin-vertical"
|
||||
v-if="currentFrequencyType === ScheduledTemplateFrequencyType.Daily.type">
|
||||
<f7-list-item :title="tt('Daily')"></f7-list-item>
|
||||
</f7-list>
|
||||
<f7-list dividers class="schedule-frequency-value-list no-margin-vertical"
|
||||
v-if="currentFrequencyType === ScheduledTemplateFrequencyType.Weekly.type">
|
||||
<f7-list-item checkbox
|
||||
@@ -57,6 +61,18 @@
|
||||
@change="changeFrequencyValue">
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
<f7-list dividers class="schedule-frequency-value-list no-margin-vertical"
|
||||
v-if="currentFrequencyType === ScheduledTemplateFrequencyType.Yearly.type">
|
||||
<f7-list-item checkbox
|
||||
:class="isChecked(monthAndDay.type) ? 'list-item-selected' : ''"
|
||||
:key="monthAndDay.type"
|
||||
:value="monthAndDay.type"
|
||||
:checked="isChecked(monthAndDay.type)"
|
||||
:title="monthAndDay.displayName"
|
||||
v-for="monthAndDay in allAvailableMonthAndDays"
|
||||
@change="changeFrequencyValue">
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,7 +107,13 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const { tt } = useI18n();
|
||||
const { allTransactionScheduledFrequencyTypes, allWeekDays, allAvailableMonthDays, getFrequencyValues } = useScheduleFrequencySelectionBase();
|
||||
const {
|
||||
allTransactionScheduledFrequencyTypes,
|
||||
allWeekDays,
|
||||
allAvailableMonthDays,
|
||||
allAvailableMonthAndDays,
|
||||
getFrequencyValues
|
||||
} = useScheduleFrequencySelectionBase();
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -108,10 +130,14 @@ function changeFrequencyType(value: number): void {
|
||||
if (currentFrequencyType.value !== value) {
|
||||
currentFrequencyType.value = value;
|
||||
|
||||
if (value === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
if (value === ScheduledTemplateFrequencyType.Daily.type) {
|
||||
currentFrequencyValue.value = [0];
|
||||
} else if (value === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
currentFrequencyValue.value = [firstDayOfWeek.value];
|
||||
} else if (value === ScheduledTemplateFrequencyType.Monthly.type) {
|
||||
currentFrequencyValue.value = [1];
|
||||
} else if (value === ScheduledTemplateFrequencyType.Yearly.type) {
|
||||
currentFrequencyValue.value = [101];
|
||||
} else {
|
||||
currentFrequencyValue.value = [];
|
||||
}
|
||||
|
||||
@@ -32,8 +32,10 @@ export class ScheduledTemplateFrequencyType implements TypeAndName {
|
||||
private static readonly allInstancesByType: Record<number, ScheduledTemplateFrequencyType> = {};
|
||||
|
||||
public static readonly Disabled = new ScheduledTemplateFrequencyType(0, 'Disabled');
|
||||
public static readonly Daily = new ScheduledTemplateFrequencyType(3, 'Daily');
|
||||
public static readonly Weekly = new ScheduledTemplateFrequencyType(1, 'Weekly');
|
||||
public static readonly Monthly = new ScheduledTemplateFrequencyType(2, 'Monthly');
|
||||
public static readonly Yearly = new ScheduledTemplateFrequencyType(4, 'Yearly');
|
||||
|
||||
public readonly type: number;
|
||||
public readonly name: string;
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} Tage",
|
||||
"everyMultiDaysOfWeek": "Jeden {days}",
|
||||
"everyMultiDaysOfMonth": "Jeden {days} des Monats",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Sie haben {count} Konten erfasst",
|
||||
"addNewTag": "Neuen Tag \"{tag}\" hinzufügen",
|
||||
"clickToSelectedFile": "Klicken Sie, um die Importdatei auszuwählen ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Datum auswählen",
|
||||
"Select Time": "Zeit auswählen",
|
||||
"Now": "Jetzt",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Wöchentlich",
|
||||
"Monthly": "Monatlich",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Benutzerdefiniert",
|
||||
"Greater than": "Größer als",
|
||||
"Less than": "Kleiner als",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} days",
|
||||
"everyMultiDaysOfWeek": "Every {days}",
|
||||
"everyMultiDaysOfMonth": "Every {days} of month",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "You have recorded {count} accounts",
|
||||
"addNewTag": "Add new tag \"{tag}\"",
|
||||
"clickToSelectedFile": "Click to select import file ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Select Date",
|
||||
"Select Time": "Select Time",
|
||||
"Now": "Now",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Weekly",
|
||||
"Monthly": "Monthly",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Custom",
|
||||
"Greater than": "Greater than",
|
||||
"Less than": "Less than",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} días",
|
||||
"everyMultiDaysOfWeek": "Cada {days}",
|
||||
"everyMultiDaysOfMonth": "Cada {days} del mes",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Has registrado {count} cuentas",
|
||||
"addNewTag": "Agregar nueva etiqueta \"{tag}\"",
|
||||
"clickToSelectedFile": "Haz clic para seleccionar el archivo de importación ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Seleccionar Fecha",
|
||||
"Select Time": "Seleccionar Hora",
|
||||
"Now": "Ahora",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Semanalmente",
|
||||
"Monthly": "Mensual",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Personalizar",
|
||||
"Greater than": "Más que",
|
||||
"Less than": "Menos que",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} jours",
|
||||
"everyMultiDaysOfWeek": "Tous les {days}",
|
||||
"everyMultiDaysOfMonth": "Tous les {days} du mois",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Vous avez enregistré {count} comptes",
|
||||
"addNewTag": "Ajouter une nouvelle étiquette \"{tag}\"",
|
||||
"clickToSelectedFile": "Cliquez pour sélectionner le fichier d'importation ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Sélectionner la date",
|
||||
"Select Time": "Sélectionner l'heure",
|
||||
"Now": "Maintenant",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Hebdomadaire",
|
||||
"Monthly": "Mensuel",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Personnalisé",
|
||||
"Greater than": "Supérieur à",
|
||||
"Less than": "Inférieur à",
|
||||
|
||||
@@ -1688,6 +1688,31 @@ export function useI18n() {
|
||||
}
|
||||
}
|
||||
|
||||
function getMultiMonthAndDayLongNames(monthAndDays: number[]): string {
|
||||
if (!monthAndDays) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const now: DateTime = getCurrentDateTime();
|
||||
|
||||
const finalMonthAndDayNames: string[] = monthAndDays.map(monthAndDay => {
|
||||
const month = Math.trunc(monthAndDay / 100);
|
||||
const day = monthAndDay % 100;
|
||||
const dateTime = now.set({
|
||||
month: month,
|
||||
dayOfMonth: day,
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
millisecond: 0
|
||||
});
|
||||
|
||||
return formatDateTime(dateTime, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions());
|
||||
});
|
||||
|
||||
return joinMultiText(finalMonthAndDayNames);
|
||||
}
|
||||
|
||||
function getMultiMonthdayShortNames(monthDays: number[]): string {
|
||||
if (!monthDays) {
|
||||
return '';
|
||||
@@ -2561,6 +2586,7 @@ export function useI18n() {
|
||||
getWeekdayShortName,
|
||||
getWeekdayLongName,
|
||||
getQuarterName,
|
||||
getMultiMonthAndDayLongNames,
|
||||
getMultiMonthdayShortNames,
|
||||
getMultiWeekdayLongNames,
|
||||
getAllLocalizedDigits,
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} giorni",
|
||||
"everyMultiDaysOfWeek": "Ogni {days}",
|
||||
"everyMultiDaysOfMonth": "Ogni {days} del mese",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Hai registrato {count} profili",
|
||||
"addNewTag": "Aggiungi nuovo giorno \"{tag}\"",
|
||||
"clickToSelectedFile": "Carica un file ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Seleziona data",
|
||||
"Select Time": "Seleziona ora",
|
||||
"Now": "Adesso",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Settimanale",
|
||||
"Monthly": "Mensile",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Personalizzato",
|
||||
"Greater than": "Maggiore di",
|
||||
"Less than": "Minore di",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays}日間",
|
||||
"everyMultiDaysOfWeek": "毎{days}",
|
||||
"everyMultiDaysOfMonth": "毎月{days}日",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "{count}アカウントを記録しました",
|
||||
"addNewTag": "新しいタグ\"{tag}\"を追加しました",
|
||||
"clickToSelectedFile": "クリックしてインポートファイルを選択します({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "日付を選択",
|
||||
"Select Time": "時間を選択",
|
||||
"Now": "今",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "毎週",
|
||||
"Monthly": "毎月",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "カスタム",
|
||||
"Greater than": "より大きい",
|
||||
"Less than": "より小さい",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} ದಿನಗಳು",
|
||||
"everyMultiDaysOfWeek": "ಪ್ರತಿ {days}",
|
||||
"everyMultiDaysOfMonth": "ಪ್ರತಿ {days} ತಿಂಗಳಲ್ಲಿ",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "ನೀವು {count} ಖಾತೆಗಳನ್ನು ದಾಖಲಿಸಿದ್ದೀರಿ",
|
||||
"addNewTag": "ಹೊಸ ಟ್ಯಾಗ್ ಸೇರಿಸಿ \"{tag}\"",
|
||||
"clickToSelectedFile": "ಆಮದು ಫೈಲ್ ಆಯ್ಕೆ ಮಾಡಲು ಕ್ಲಿಕ್ ಮಾಡಿ ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "ದಿನಾಂಕ ಆಯ್ಕೆಮಾಡಿ",
|
||||
"Select Time": "ಸಮಯ ಆಯ್ಕೆಮಾಡಿ",
|
||||
"Now": "ಈಗ",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "ವಾರದಂತೆ",
|
||||
"Monthly": "ತಿಂಗಳಂತೆ",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "ಕಸ್ಟಮ್",
|
||||
"Greater than": "ಹೆಚ್ಚಾಗಿದೆ",
|
||||
"Less than": "ಕಡಿಮೆ",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays}일",
|
||||
"everyMultiDaysOfWeek": "매주 {days}",
|
||||
"everyMultiDaysOfMonth": "매월 {days}일",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "{count}개의 계정을 기록했습니다",
|
||||
"addNewTag": "새 태그 \"{tag}\"를 추가했습니다.",
|
||||
"clickToSelectedFile": "클릭해서 내보내기할 파일을 선택하세요 ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "날짜 선택",
|
||||
"Select Time": "시간 선택",
|
||||
"Now": "지금",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "주간",
|
||||
"Monthly": "월간",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "사용자 지정",
|
||||
"Greater than": "초과",
|
||||
"Less than": "미만",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} dagen",
|
||||
"everyMultiDaysOfWeek": "Elke {days}",
|
||||
"everyMultiDaysOfMonth": "Elke {days} van de maand",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Je hebt {count} rekeningen geregistreerd",
|
||||
"addNewTag": "Nieuwe tag toevoegen \"{tag}\"",
|
||||
"clickToSelectedFile": "Klik om importbestand te selecteren ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Selecteer datum",
|
||||
"Select Time": "Selecteer tijd",
|
||||
"Now": "Nu",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Wekelijks",
|
||||
"Monthly": "Maandelijks",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Aangepast",
|
||||
"Greater than": "Groter dan",
|
||||
"Less than": "Kleiner dan",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} dias",
|
||||
"everyMultiDaysOfWeek": "A cada {days}",
|
||||
"everyMultiDaysOfMonth": "Todo dia {days}",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Você registrou {count} contas",
|
||||
"addNewTag": "Adicionar nova etiqueta \"{tag}\"",
|
||||
"clickToSelectedFile": "Clique para selecionar o arquivo de importação ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Selecionar Data",
|
||||
"Select Time": "Selecionar Hora",
|
||||
"Now": "Agora",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Semanal",
|
||||
"Monthly": "Mensal",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Personalizado",
|
||||
"Greater than": "Maior que",
|
||||
"Less than": "Menor que",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} дней",
|
||||
"everyMultiDaysOfWeek": "Каждые {days}",
|
||||
"everyMultiDaysOfMonth": "Каждое {days} число месяца",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "У вас зарегистрировано {count} учетных записей",
|
||||
"addNewTag": "Добавить новый тег \"{tag}\"",
|
||||
"clickToSelectedFile": "Нажмите, чтобы выбрать файл для импорта ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Выбрать дату",
|
||||
"Select Time": "Выбрать время",
|
||||
"Now": "Сейчас",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Еженедельно",
|
||||
"Monthly": "Ежемесячно",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Настроить",
|
||||
"Greater than": "Больше чем",
|
||||
"Less than": "Меньше чем",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} dni",
|
||||
"everyMultiDaysOfWeek": "Vsak {days}",
|
||||
"everyMultiDaysOfMonth": "Vsak {days} v mesecu",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Zabeležili ste {count} računov",
|
||||
"addNewTag": "Dodaj novo oznako \"{tag}\"",
|
||||
"clickToSelectedFile": "Kliknite za izbiro datoteke za uvoz ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Izberi datum",
|
||||
"Select Time": "Izberi čas",
|
||||
"Now": "Zdaj",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Tedensko",
|
||||
"Monthly": "Mesečno",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Po meri",
|
||||
"Greater than": "Več kot",
|
||||
"Less than": "Manj kot",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} நாட்கள்",
|
||||
"everyMultiDaysOfWeek": "ஒவ்வொரு {days}",
|
||||
"everyMultiDaysOfMonth": "மாதத்தில் ஒவ்வொரு {days}",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "நீங்கள் {count} கணக்குகளை பதிவு செய்துள்ளீர்கள்",
|
||||
"addNewTag": "புதிய குறிச்சொல் சேர்க்க \"{tag}\"",
|
||||
"clickToSelectedFile": "இறக்குமதி கோப்பைத் தேர்ந்தெடுக்க கிளிக் செய்யவும் ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "தேதி தேர்வு செய்யவும்",
|
||||
"Select Time": "நேரம் தேர்வு செய்யவும்",
|
||||
"Now": "இப்போது",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "வாரம்தோறும்",
|
||||
"Monthly": "மாதம்தோறும்",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "தனிப்பயன்",
|
||||
"Greater than": "அதிகமாக",
|
||||
"Less than": "குறைவு",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} วัน",
|
||||
"everyMultiDaysOfWeek": "ทุกๆ {days}",
|
||||
"everyMultiDaysOfMonth": "ทุกๆ {days} ของเดือน",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "คุณได้บันทึกบัญชี {count} บัญชี",
|
||||
"addNewTag": "เพิ่มแท็กใหม่ \"{tag}\"",
|
||||
"clickToSelectedFile": "คลิกเพื่อเลือกไฟล์นำเข้า ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "เลือกวันที่",
|
||||
"Select Time": "เลือกเวลา",
|
||||
"Now": "ตอนนี้",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "รายสัปดาห์",
|
||||
"Monthly": "รายเดือน",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "กำหนดเอง",
|
||||
"Greater than": "มากกว่า",
|
||||
"Less than": "น้อยกว่า",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} gün",
|
||||
"everyMultiDaysOfWeek": "Her {days}",
|
||||
"everyMultiDaysOfMonth": "Ayın her {days} günü",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "{count} adet hesap kaydettiniz",
|
||||
"addNewTag": "Yeni etiket ekle: \"{tag}\"",
|
||||
"clickToSelectedFile": "İçe aktarılacak dosyayı seçmek için tıklayın ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Tarih Seç",
|
||||
"Select Time": "Zaman Seç",
|
||||
"Now": "Şimdi",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Haftalık",
|
||||
"Monthly": "Aylık",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Özel",
|
||||
"Greater than": "Büyüktür",
|
||||
"Less than": "Küçüktür",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} днів",
|
||||
"everyMultiDaysOfWeek": "Кожні {days}",
|
||||
"everyMultiDaysOfMonth": "Кожного {days} числа місяця",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "У вас зареєстровано {count} рахунків",
|
||||
"addNewTag": "Додати новий тег \"{tag}\"",
|
||||
"clickToSelectedFile": "Натисніть, щоб вибрати файл для імпорту ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Обрати дату",
|
||||
"Select Time": "Обрати час",
|
||||
"Now": "Зараз",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Щотижня",
|
||||
"Monthly": "Щомісяця",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Налаштувати",
|
||||
"Greater than": "Більше ніж",
|
||||
"Less than": "Менше ніж",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays} ngày",
|
||||
"everyMultiDaysOfWeek": "Mỗi {days}",
|
||||
"everyMultiDaysOfMonth": "Mỗi ngày {days} trong tháng",
|
||||
"everyMultiDaysOfYear": "Every {days} of year",
|
||||
"youHaveAccounts": "Bạn đã ghi nhận {count} tài khoản",
|
||||
"addNewTag": "Add new tag \"{tag}\"",
|
||||
"clickToSelectedFile": "Nhấp để chọn tệp nhập khẩu ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "Chọn ngày",
|
||||
"Select Time": "Chọn thời gian",
|
||||
"Now": "Bây giờ",
|
||||
"Daily": "Daily",
|
||||
"Weekly": "Hàng tuần",
|
||||
"Monthly": "Hàng tháng",
|
||||
"Yearly": "Yearly",
|
||||
"Custom": "Tùy chỉnh",
|
||||
"Greater than": "Lớn hơn",
|
||||
"Less than": "Nhỏ hơn",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays}",
|
||||
"everyMultiDaysOfWeek": "每{days}",
|
||||
"everyMultiDaysOfMonth": "每月{days}",
|
||||
"everyMultiDaysOfYear": "每年{days}",
|
||||
"youHaveAccounts": "您已经记录了 {count} 个账户",
|
||||
"addNewTag": "添加新标签 \"{tag}\"",
|
||||
"clickToSelectedFile": "点击选择导入文件 ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "选择日期",
|
||||
"Select Time": "选择时间",
|
||||
"Now": "现在",
|
||||
"Daily": "每天",
|
||||
"Weekly": "每周",
|
||||
"Monthly": "每月",
|
||||
"Yearly": "每年",
|
||||
"Custom": "自定义",
|
||||
"Greater than": "大于",
|
||||
"Less than": "小于",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"monthDays": "{multiMonthDays}",
|
||||
"everyMultiDaysOfWeek": "每{days}",
|
||||
"everyMultiDaysOfMonth": "每月{days}",
|
||||
"everyMultiDaysOfYear": "每年{days}",
|
||||
"youHaveAccounts": "您已經記錄了 {count} 個帳戶",
|
||||
"addNewTag": "新增標籤 \"{tag}\"",
|
||||
"clickToSelectedFile": "點擊選擇匯入檔案 ({extensions})",
|
||||
@@ -1553,8 +1554,10 @@
|
||||
"Select Date": "選擇日期",
|
||||
"Select Time": "選擇時間",
|
||||
"Now": "現在",
|
||||
"Daily": "每天",
|
||||
"Weekly": "每週",
|
||||
"Monthly": "每月",
|
||||
"Yearly": "每年",
|
||||
"Custom": "自訂",
|
||||
"Greater than": "大於",
|
||||
"Less than": "小於",
|
||||
|
||||
@@ -565,6 +565,7 @@ const pageTypeAndMode = getPageTypeNameMode();
|
||||
|
||||
const {
|
||||
tt,
|
||||
getMultiMonthAndDayLongNames,
|
||||
getMultiMonthdayShortNames,
|
||||
getMultiWeekdayLongNames,
|
||||
formatDateTimeToLongDate,
|
||||
@@ -780,7 +781,9 @@ const transactionDisplayScheduledFrequency = computed<string>(() => {
|
||||
}
|
||||
}
|
||||
|
||||
if (template.scheduledFrequencyType === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
if (template.scheduledFrequencyType === ScheduledTemplateFrequencyType.Daily.type) {
|
||||
return tt('Daily');
|
||||
} else if (template.scheduledFrequencyType === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
if (scheduledFrequencyValues.length) {
|
||||
return tt('format.misc.everyMultiDaysOfWeek', {
|
||||
days: getMultiWeekdayLongNames(scheduledFrequencyValues, firstDayOfWeek.value)
|
||||
@@ -796,6 +799,14 @@ const transactionDisplayScheduledFrequency = computed<string>(() => {
|
||||
} else {
|
||||
return tt('Monthly');
|
||||
}
|
||||
} else if (template.scheduledFrequencyType === ScheduledTemplateFrequencyType.Yearly.type) {
|
||||
if (scheduledFrequencyValues.length) {
|
||||
return tt('format.misc.everyMultiDaysOfYear', {
|
||||
days: getMultiMonthAndDayLongNames(scheduledFrequencyValues)
|
||||
});
|
||||
} else {
|
||||
return tt('Yearly');
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user