Skip to content

Commit

Permalink
👌 [#3755] PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Jan 22, 2024
1 parent 25589d3 commit 434d7f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/formio/validators/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
24 changes: 6 additions & 18 deletions src/jstests/formio/components/datetime.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -221,7 +211,5 @@ describe('Datetime Component', () => {
expect(
componentInstance.openForms.validationErrorContext.minMaxDatetimeValidatorErrorKeys
).toContain('minDatetime');

done();
});
});

0 comments on commit 434d7f6

Please sign in to comment.