Skip to content

Conversation

@SegiNyn
Copy link
Contributor

@SegiNyn SegiNyn commented Apr 9, 2025

This is to add min and max date configuration in the registration form DateField.

@SegiNyn SegiNyn force-pushed the date-field-min-max-settings branch from 90543bc to 8b56a91 Compare April 9, 2025 14:28
@SegiNyn SegiNyn force-pushed the date-field-min-max-settings branch from 8b56a91 to 490e83d Compare July 31, 2025 13:19
Copy link
Member

@OmeGak OmeGak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems strange that the date fields do not take all the horizontal space. This is caused by the following CSS rule.

ind-date-picker {
  ...
  width: fit-content;
  ...
}
Image

It would look nicer if it took the entire width:

Image

@ThiefMaster
Copy link
Member

It seems strange that the date fields do not take all the horizontal space. This is caused by the following CSS rule.

I guess in most places it looks nicer if a date picker field does not become super wide...

@SegiNyn SegiNyn force-pushed the date-field-min-max-settings branch from 490e83d to 67cacaf Compare August 13, 2025 08:47
@SegiNyn SegiNyn requested review from OmeGak and ThiefMaster August 13, 2025 09:30
@SegiNyn SegiNyn force-pushed the date-field-min-max-settings branch 2 times, most recently from 74e7c5d to 80b998e Compare October 27, 2025 10:04
@SegiNyn
Copy link
Contributor Author

SegiNyn commented Oct 27, 2025

Hello @ThiefMaster , just a reminder about this PR. It’s been open for a while and I wanted to see if there’s anything else needed before it can be merged. If it helps, I've rebased it again so it's up to date. Thanks.

);
}

export function dateSettingsFormValidator({minDate, maxDate, dateFormat}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For dateFormat === '%Y' the behavior of the field is a bit weird, since for a user it's not clear that any year selected by a user will become xxxx-01-01, so if you just conveniently select let's say 2025-10-27 (current day) as the minDate, then it actually results in a 2026 minimum year.

Not sure what's the best solution here...

  • disable minDate/maxDate when using the year-only format?
  • add validation to disallow anything but xxxx-01-01 as the minDate when this format is selected?
  • automatically jump to xxxx-01-01 for minDate and xxxx-12-31` for maxDate when this format is selected? this doesn't really work w/ the date picker since it does not display

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One possibility for option 3 would be doing this on the server side to avoid the hassle w/ final-form and the date picker. I think if you put ANY 2025 date as minDate you'd expect the year 2025 to be accepted anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, since FinalDatePicker has a filter prop, I tested filtering the dates so that only Jan 1st of the year can be selected. I think this combines solution 2 and option 3 (validating in the server side) in 4df1ab5

Since the date will be 01/01 of the year inputted by the user, is it also necessary to do the same validation for the maxDate? they select the same year then they still can only choose that year only (they can only choose 2025 regardless of if the max date is 01/02/2025 or 31/12/2025)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filtering the selectable calendar is nice :) However, you also need validation because one can type a date (unless the field already considers such a date invalid)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the extra validation was needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some validation regarding max date was still missing, I just added that

@ThiefMaster ThiefMaster force-pushed the date-field-min-max-settings branch from d5be03f to 1d191e1 Compare December 1, 2025 17:03
@ThiefMaster ThiefMaster merged commit f3508de into indico:master Dec 1, 2025
10 checks passed
@ThiefMaster ThiefMaster deleted the date-field-min-max-settings branch December 1, 2025 17:48
@ThiefMaster ThiefMaster added this to the v3.3 milestone Dec 1, 2025
opacity: 0.8;
}

ind-date-picker {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI, CSS modules do not work on tags, they are global. And this change broke the date picker looks e.g. in the event creation dialog when opened from a page that loads regform CSS.

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, sorry about that. Great you caught it quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants