commit 67233ce29361ac8377980dc6cb365e94d0add6fe
parent 4d35bb8941cc48b4c17ee1552c0948db69f1e07e
Author: Sebastian <sebasjm@gmail.com>
Date: Wed, 14 May 2025 12:15:22 -0300
fix #9866
Diffstat:
6 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/packages/web-util/src/forms/gana/GLS_Onboarding.ts b/packages/web-util/src/forms/gana/GLS_Onboarding.ts
@@ -1,5 +1,5 @@
import { TalerFormAttributes } from "@gnu-taler/taler-util";
-import { isFuture, parse } from "date-fns";
+import { intervalToDuration, isFuture, parse } from "date-fns";
import {
DoubleColumnFormDesign,
InternationalizationAPI,
@@ -47,6 +47,13 @@ export function GLS_Onboarding(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if ( years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
return undefined;
},
},
@@ -149,6 +156,13 @@ export function GLS_Onboarding(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if ( years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
return undefined;
},
},
diff --git a/packages/web-util/src/forms/gana/VQF_902_11_officer.ts b/packages/web-util/src/forms/gana/VQF_902_11_officer.ts
@@ -132,10 +132,11 @@ export function VQF_902_11_officer(
{
id: TalerFormAttributes.SIGN_DATE,
label: i18n.str`Date`,
- type: "absoluteTimeText",
+ type: "isoDateText",
placeholder: "dd/MM/yyyy",
pattern: "dd/MM/yyyy",
required: true,
+ defaultValue: today,
disabled: true,
},
],
diff --git a/packages/web-util/src/forms/gana/VQF_902_1_customer.ts b/packages/web-util/src/forms/gana/VQF_902_1_customer.ts
@@ -15,7 +15,7 @@
*/
import { TalerFormAttributes } from "@gnu-taler/taler-util";
-import { isFuture, parse } from "date-fns";
+import { intervalToDuration, isFuture, parse } from "date-fns";
import {
DoubleColumnFormDesign,
InternationalizationAPI,
@@ -142,6 +142,13 @@ export function design_VQF_902_1_customer(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if ( years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
return undefined;
},
},
@@ -293,7 +300,14 @@ export function design_VQF_902_1_customer(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
- return undefined;
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if ( years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
+ return undefined;
},
},
{
diff --git a/packages/web-util/src/forms/gana/VQF_902_1_officer.ts b/packages/web-util/src/forms/gana/VQF_902_1_officer.ts
@@ -15,7 +15,7 @@
*/
import { TalerFormAttributes } from "@gnu-taler/taler-util";
-import { format, isFuture, isToday, parse } from "date-fns";
+import { format, intervalToDuration, isFuture, isToday, parse } from "date-fns";
import {
DoubleColumnFormDesign,
FormMetadata,
@@ -130,6 +130,13 @@ export function VQF_902_1_officer(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if ( years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
return undefined;
},
},
diff --git a/packages/web-util/src/forms/gana/VQF_902_9_customer.ts b/packages/web-util/src/forms/gana/VQF_902_9_customer.ts
@@ -5,7 +5,7 @@ import {
InternationalizationAPI,
} from "../../index.browser.js";
import { countryNationalityList } from "../../utils/select-ui-lists.js";
-import { format, isFuture, parse } from "date-fns";
+import { format, intervalToDuration, isFuture, parse } from "date-fns";
export const form_vqf_902_9_customer = (
i18n: InternationalizationAPI,
@@ -77,6 +77,13 @@ export function VQF_902_9_customer(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if (years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
return undefined;
},
},
diff --git a/packages/web-util/src/forms/gana/VQF_902_9_officer.ts b/packages/web-util/src/forms/gana/VQF_902_9_officer.ts
@@ -5,7 +5,7 @@ import {
InternationalizationAPI,
} from "../../index.browser.js";
import { countryNationalityList } from "../../utils/select-ui-lists.js";
-import { isFuture, parse } from "date-fns";
+import { intervalToDuration, isFuture, parse } from "date-fns";
export const form_vqf_902_9_officer = (
i18n: InternationalizationAPI,
@@ -75,6 +75,13 @@ export function VQF_902_9_officer(
if (isFuture(time)) {
return i18n.str`it can't be in the future`;
}
+ const { years } = intervalToDuration({
+ start: new Date(),
+ end: time,
+ });
+ if (years && years > 120) {
+ return i18n.str`it can't be greater than 120 years`;
+ }
return undefined;
},
},