From 434d7f6718e8158ebc05343d4457b58a68d59c30 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Mon, 22 Jan 2024 16:09:23 +0100 Subject: [PATCH] :ok_hand: [#3755] PR Feedback --- src/formio/validators/utils.js | 2 +- .../formio/components/datetime.spec.js | 24 +++++-------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/formio/validators/utils.js b/src/formio/validators/utils.js index 48a289762..d4eecbf80 100644 --- a/src/formio/validators/utils.js +++ b/src/formio/validators/utils.js @@ -8,7 +8,7 @@ export const validateBoundaries = (componentType, minBoundary, maxBoundary, valu return {isValid: true}; } - const parsedValue = parseISO(value, 'yyyy-MM-dd', new Date()); + const parsedValue = parseISO(value); let errorKeyMinValue, errorKeyMaxValue; if (componentType === 'date') { diff --git a/src/jstests/formio/components/datetime.spec.js b/src/jstests/formio/components/datetime.spec.js index 75261974b..43a31b01c 100644 --- a/src/jstests/formio/components/datetime.spec.js +++ b/src/jstests/formio/components/datetime.spec.js @@ -6,7 +6,7 @@ import MinMaxDatetimeValidator from 'formio/validators/minMaxDatetimeValidator'; const FormioComponent = Formio.Components.components.component; describe('Datetime Component', () => { - test('Datetime validator: no min/max datetime', done => { + test('Datetime validator: no min/max datetime', () => { const component = { label: 'datetime', key: 'datetime', @@ -30,11 +30,9 @@ describe('Datetime Component', () => { ); expect(isValid).toBeTruthy(); - - done(); }); - test('Datetime validator: check min datetime', done => { + test('Datetime validator: check min datetime', () => { const component = { label: 'datetime', key: 'datetime', @@ -69,11 +67,9 @@ describe('Datetime Component', () => { ); expect(isValid2).toBeTruthy(); - - done(); }); - test('Datetime validator: check max datetime', done => { + test('Datetime validator: check max datetime', () => { const component = { label: 'datetime', key: 'datetime', @@ -108,11 +104,9 @@ describe('Datetime Component', () => { ); expect(isValid2).toBeTruthy(); - - done(); }); - test('Datetime validator: check max datetime including the current one', done => { + test('Datetime validator: check max datetime including the current one', () => { const component = { label: 'datetime', key: 'datetime', @@ -136,11 +130,9 @@ describe('Datetime Component', () => { ); expect(isValid1).toBeTruthy(); - - done(); }); - test('Datetime validator: error message', done => { + test('Datetime validator: error message', () => { const component = { label: 'datetime', key: 'datetime', @@ -179,11 +171,9 @@ describe('Datetime Component', () => { MinMaxDatetimeValidator.message(componentInstance); expect(mockTranslation.mock.calls[2][0]).toEqual('maxDatetime'); - - done(); }); - test('Datetime validator: check max datetime AND min datetime', done => { + test('Datetime validator: check max datetime AND min datetime', () => { const component = { label: 'datetime', key: 'datetime', @@ -221,7 +211,5 @@ describe('Datetime Component', () => { expect( componentInstance.openForms.validationErrorContext.minMaxDatetimeValidatorErrorKeys ).toContain('minDatetime'); - - done(); }); });