第3项:旧界面与 React 共用对账、回收及基础业务规则
This commit is contained in:
1 parent
54c05879d5
commit
389952f31c
65 files changed
+2265
-3800
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { Calc, Model, type LedgerState } from '../../shared';
|
||||
import { Calc, Model, Values, type LedgerState } from '../../shared';
|
||||
import { yuan } from '../../lib/format';
|
||||
|
||||
export interface Purchase {
|
||||
@@ -155,11 +155,7 @@ export const poolRows = (data: PoolResult) =>
|
||||
data.rolling?.enabled && data.current
|
||||
? [data.current, ...data.rows.filter(p => p.id !== data.current!.id)]
|
||||
: data.rows;
|
||||
export function validDate(value: string) {
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
|
||||
const date = new Date(value + 'T12:00:00Z');
|
||||
return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
|
||||
}
|
||||
export const validDate = Values.validDate;
|
||||
const integer = (n: unknown) => typeof n === 'number' && Number.isSafeInteger(n) && n >= 0;
|
||||
const amount = (n: unknown) => n === null || integer(n);
|
||||
export function validatePools(data: PoolResult) {
|
||||
|
||||
Reference in new issue
Block a user