mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
support setting the last 1 to 3 days of the month to scheduled transaction frequency
This commit is contained in:
+36
-7
@@ -1693,16 +1693,45 @@ export function useI18n() {
|
||||
return '';
|
||||
}
|
||||
|
||||
monthDays.sort(function (d1, d2) {
|
||||
if (d1 >= 0 && d2 >= 0) {
|
||||
return d1 - d2;
|
||||
} else if (d1 < 0 && d2 < 0) {
|
||||
return d1 - d2;
|
||||
} else if (d1 >= 0 && d2 < 0) {
|
||||
return -1; // make positive month day come first
|
||||
} else { // if (d1 < 0 && d2 >= 0)
|
||||
return 1; // make positive month day come first
|
||||
}
|
||||
});
|
||||
|
||||
if (monthDays.length === 1) {
|
||||
return t('format.misc.monthDay', {
|
||||
ordinal: getMonthdayOrdinal(monthDays[0] as number)
|
||||
});
|
||||
const monthDay = monthDays[0] as number;
|
||||
|
||||
if (monthDay >= 0) {
|
||||
return t('format.misc.monthDay', {
|
||||
ordinal: getMonthdayOrdinal(monthDay)
|
||||
});
|
||||
} else if (monthDay === -1) {
|
||||
return t('last day');
|
||||
} else {
|
||||
return t('format.misc.lastMonthDayInLowercase', {
|
||||
ordinal: getMonthdayOrdinal(-monthDay)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return t('format.misc.monthDays', {
|
||||
multiMonthDays: joinMultiText(monthDays.map(monthDay =>
|
||||
t('format.misc.eachMonthDayInMonthDays', {
|
||||
ordinal: getMonthdayOrdinal(monthDay)
|
||||
})))
|
||||
multiMonthDays: joinMultiText(monthDays.map(monthDay => {
|
||||
if (monthDay >= 0) {
|
||||
return t('format.misc.eachMonthDayInMonthDays', {
|
||||
ordinal: getMonthdayOrdinal(monthDay)
|
||||
});
|
||||
} else {
|
||||
return t('format.misc.eachLastMonthDayInMonthDays', {
|
||||
ordinal: getMonthdayOrdinal(-monthDay)
|
||||
});
|
||||
}
|
||||
}))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user