Skip to content
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(Field.Date): add built in error messaging for min and max dates (WIP) #4469

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e8257d5
add min max date validation hook
joakbjerk Jan 16, 2025
98ba80b
add min max validation messages
joakbjerk Jan 16, 2025
38741f1
rename validation hook
joakbjerk Jan 16, 2025
781161e
rename error messages
joakbjerk Jan 17, 2025
af3f97f
add error message for range end and start dates
joakbjerk Jan 17, 2025
9ea35b7
integrate date limit validation message with status props
joakbjerk Jan 20, 2025
d1ec9e4
add format to validation
joakbjerk Jan 21, 2025
fae8346
add possiblity to merge status and dateLimitValidation message in one…
joakbjerk Jan 21, 2025
39e37f6
make date limit validation range compliant
joakbjerk Jan 21, 2025
0420212
make useDateLimitValidation return an object
joakbjerk Jan 22, 2025
f897cb9
add correct title
joakbjerk Jan 22, 2025
0361466
add tests
joakbjerk Jan 22, 2025
0b8e1b1
move dates do own describe to prevent provider to mess up other tests
joakbjerk Jan 22, 2025
a617493
add examples to docs
joakbjerk Jan 22, 2025
7c09b9f
update date error message date formatting
joakbjerk Jan 22, 2025
92fa4b2
revert DatePickerProvider
joakbjerk Jan 22, 2025
efe2896
revert FormStatus types
joakbjerk Jan 22, 2025
2043d3c
remove console.log
joakbjerk Jan 22, 2025
bdcc874
move translations to eufemia forms
joakbjerk Jan 22, 2025
d09d02e
add date limit validation to date
joakbjerk Jan 23, 2025
adcadec
remove date limit validation hook
joakbjerk Jan 23, 2025
38be90b
update error message text
joakbjerk Jan 23, 2025
c564373
move doc examples from DatePicker to Date
joakbjerk Jan 23, 2025
1bbe9b2
remove unused example import
joakbjerk Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Provider from '@dnb/eufemia/src/shared/Provider'
import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { Field } from '@dnb/eufemia/src/extensions/forms'

Expand Down Expand Up @@ -98,3 +99,18 @@ export const AutoClose = () => {
</ComponentBox>
)
}

export const DatePickerDateLimitValidation = () => {
return (
<Provider locale="en-GB">
<ComponentBox>
<Field.Date
value="2024-12-31|2025-02-01"
minDate="2025-01-01"
maxDate="2025-01-31"
range
/>
</ComponentBox>
</Provider>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ To enable the picker to close automatically, you have to set `showCancelButton`

<Examples.WithError />

### Date limit validation

The Date field will automatically display an error message if the selected date or dates are outside the given date limits.

<Examples.DatePickerDateLimitValidation />

### Validation - Required

<Examples.ValidationRequired />
Loading
Loading