-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(kit): Date
, DateTime
, DateRange
supports strict
and non-strict
modes
#1218
Conversation
Visit the preview URL for this PR (updated for commit 978c3fd): https://maskito--pr1218-non-strict-mode-date-voc8yetz.web.app (expires Sun, 12 May 2024 10:44:25 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 61e4dea776cbea516b68c67840913d2edd88bb90 |
projects/demo/src/pages/kit/date-range/date-range-mask-doc.template.html
Outdated
Show resolved
Hide resolved
projects/demo/src/pages/kit/date-time/date-time-mask-doc.template.html
Outdated
Show resolved
Hide resolved
7cbbe20
to
53e8f23
Compare
Date
, DateTime
, DateRange
supports strict
and non-strict
modesDate
, DateTime
, DateRange
supports strict
and non-strict
modes
projects/demo-integrations/src/tests/kit/date-time/date-time-strict-mode.cy.ts
Outdated
Show resolved
Hide resolved
projects/demo-integrations/src/tests/kit/date-time/date-time-strict-mode.cy.ts
Outdated
Show resolved
Hide resolved
projects/demo/src/pages/kit/date-range/examples/5-strict-mode/component.ts
Show resolved
Hide resolved
projects/demo/src/pages/kit/date-time/date-time-mask-doc.template.html
Outdated
Show resolved
Hide resolved
projects/demo/src/pages/kit/date-time/examples/4-strict-mode/component.ts
Outdated
Show resolved
Hide resolved
projects/kit/src/lib/utils/date/strict-date-time-mode-validation.ts
Outdated
Show resolved
Hide resolved
validatedValue += | ||
clampedDate.getTime() === min.getTime() || | ||
clampedDate.getTime() === max.getTime() | ||
? toDateString(dateToSegments(clampedDate), { | ||
dateMode: dateModeTemplate, | ||
}) | ||
: dateString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why cannot we use the previous approach ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if date is invalid it will make it valid. In this proccessor we don't need it
projects/kit/src/lib/processors/date-segments-validation-postprocessor.ts
Outdated
Show resolved
Hide resolved
projects/kit/src/lib/processors/date-segments-validation-postprocessor.ts
Outdated
Show resolved
Hide resolved
strictDateTimeModeValidation({ | ||
date: segmentsToDate(parsedDate), | ||
strict, | ||
dateSegments: parsedDate, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strictDateTimeModeValidation({ | |
date: segmentsToDate(parsedDate), | |
strict, | |
dateSegments: parsedDate, | |
}), | |
strict ? dateToSegments(segmentsToDate(parsedDate)) : parsedDateSegments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date and DateTime must use the same logic
projects/demo/src/pages/kit/date-range/date-range-mask-doc.template.html
Show resolved
Hide resolved
.../demo/src/pages/kit/components/strict-mode-descriptino/strict-mode-description.template.html
Outdated
Show resolved
Hide resolved
.../demo/src/pages/kit/components/strict-mode-descriptino/strict-mode-description.template.html
Outdated
Show resolved
Hide resolved
...s/demo/src/pages/kit/components/strict-mode-descriptino/strict-mode-description.component.ts
Outdated
Show resolved
Hide resolved
⛔ Lint result job has failed! |
⛔ Lint result job has failed! |
Closing this PR until it becomes more relevant for us. |
Closes #1217