-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implement Validation for Date Picker #2165
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: JeevaRamanathan M <jeevaramanathan.m@infosys.com>
I think a dict (object) might not be the more user-friendly way for the user... |
Actually I do think that a dict may be the only option we have. However, I wouldn't hardcode the notion of weekend or workday. This varies across cultures. My first thoughts about this would be a dict with two optional slots: one would indicate dates that must be forbidden, another would be dates that are explicitly available. The way I see you can express this is:
This has the issue of having days that fall in the two buckets, the a priority may be needed. Now I like the 'occurrence' thing but we need to allow for more expressivity, again. Same for 'repeat' (or 'interval'). The period (week, month, year...) needs to be expressed somehow. |
@FabienLelaquais, for example, Wednesday and Thursday (days 3 and 4) are accepted but also fall within the rejection period. Are you referring to this as falling into two buckets and needing prioritization, or is it something different? |
Hi @FabienLelaquais, I'd like to get your thoughts on the updated structure for date_constraints. I’ve added support for priority, weekly, monthly, yearly rules along with the after week attribute to address the cases like US election logic.
Prolly the same repeat format can be used for accept; Here's the sample frontend workaround logic for this structure. |
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.
Can you fix the failing checks ?
@@ -169,6 +169,7 @@ class _Factory: | |||
("on_change", PropertyType.function), | |||
("format",), | |||
("width", PropertyType.string_or_number), | |||
("disable_date_config",PropertyType.dynamic_dict) |
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.
SHould this be dynamic ?
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.
I believe it should be dynamic, as some keys in the dictionary are optional. Please correct me if I'm wrong.
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.
I believe it should be dynamic, as some keys in the dictionary are optional. Please correct me if I'm wrong.
Dynamic means that the bound variable can be updated.
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.
Thank you for the clarification, @FredLL-Avaiga. I will change it to dict.
I have fixed the checks that failed due to spelling. The remaining tests are failing because no test cases were written, correct?
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.
there are some tests failing due to an exterior factor (they're failing in the rest subtree)
Signed-off-by: JeevaRamanathan M <jeevaramanathan.m@infosys.com>
Hi @FredLL-Avaiga,
Referencing issue #848, I’ve added the following specifications for date validation to handle date disabling options:
The rules for disabling dates include options for disabling past days or future days, weekdays, weekends, or specific day of the month with
disablePastDays
,disableFutureDays
,disableWeekdays
,disableWeekends
,dayOfWeek
.To disable alternating days:
Setting
oddInterval: True
will disable Wednesdays on the 1st, 3rd, and 5th weeksTo disable the nth occurrence of a specific weekday in the month:
Could you please review this and let me know if any modifications are needed for better handling of these specifications?