mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 03:23:51 -05:00
Change minimum transaction date from 2000 to 1995 (#6440)
This change updates the minimum allowed date for transactions from 2000-01-01 to 1995-01-01, allowing users to enter older transaction dates without crashes. This addresses the date validation bug that was causing issues with old dates. - Updated date validation in schema-helpers.ts - Updated corresponding tests in schema-helpers.test.ts
This commit is contained in:
committed by
GitHub
parent
d437d6e4f3
commit
80bb888bae
@@ -210,15 +210,15 @@ describe('schema-helpers', () => {
|
||||
}).toThrow('Can’t convert to integer');
|
||||
});
|
||||
|
||||
test('dates before 2000-01-01 are rejected', () => {
|
||||
test('dates before 1995-01-01 are rejected', () => {
|
||||
expect(() => {
|
||||
convertForInsert(basicSchema, {}, 'transactions', {
|
||||
id: 't1',
|
||||
account: 'foo',
|
||||
amount: 5,
|
||||
date: '1999-12-31',
|
||||
date: '1994-12-31',
|
||||
});
|
||||
}).toThrow('Invalid date: 1999-12-31');
|
||||
}).toThrow('Invalid date: 1994-12-31');
|
||||
|
||||
expect(() => {
|
||||
convertForInsert(basicSchema, {}, 'transactions', {
|
||||
@@ -230,13 +230,13 @@ describe('schema-helpers', () => {
|
||||
}).toThrow('Invalid date: 1900-01-01');
|
||||
});
|
||||
|
||||
test('dates on or after 2000-01-01 are accepted', () => {
|
||||
test('dates on or after 1995-01-01 are accepted', () => {
|
||||
const trans = convertForInsert(basicSchema, {}, 'transactions', {
|
||||
id: 't1',
|
||||
account: 'foo',
|
||||
amount: 5,
|
||||
date: '2000-01-01',
|
||||
date: '1995-01-01',
|
||||
});
|
||||
expect(trans.date).toBe(20000101);
|
||||
expect(trans.date).toBe(19950101);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ export function convertInputType(value, type) {
|
||||
return toDateRepr(dayFromDate(value));
|
||||
} else if (
|
||||
value.match(/^\d{4}-\d{2}-\d{2}$/) == null ||
|
||||
value < '2000-01-01'
|
||||
value < '1995-01-01'
|
||||
) {
|
||||
throw new Error('Invalid date: ' + value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user