-
Notifications
You must be signed in to change notification settings - Fork 125
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
fix: (core) Datepicker and DateTimePicker: Respect disabled/block function by inputs #1787
Conversation
… on input type, in datepicker and datetimepicker
Deploy preview for fundamental-ngx ready! Built with commit 0529d35 |
6aa2173
to
8a06416
Compare
@@ -74,7 +74,9 @@ | |||
<fd-docs-section-title [id]="'combobox-reactiveForm'" [componentName]="'datePicker'"> | |||
Date Picker in Reactive Form | |||
</fd-docs-section-title> | |||
<description>The date-picker component may also be used within Angular Reactive Forms.</description> | |||
<description>The date-picker component may also be used within Angular Reactive Forms. There is used | |||
<code>[disableFunction]</code>, which controls the <code>valid</code> flag |
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.
Maybe
"[disableFunction]
is used to control the valid
flag"
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.
the [disableFunction]
controls the valid
flag
LGTM (I will not approve now to give a chance to the others to also take a look at it) |
@mpienkowski could you take a look at the fix for the issue you opened? Thank you! |
selectedRangeDate.start = this.invalidDate(); | ||
} | ||
|
||
/** If end date is invalid, cause of format, block or disable function, there is invalidDate forced */ |
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.
do you mean because "because of format, block..."?
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.
It's changed to because
Is there any example of showing a disabled range of dates? |
Hi @stefanoScalzo, there is example of disabledFunction on range mode. |
I think we should create separate example focusing only disabling dates. It took me a while until I found the one using
Maybe lets leave one more complex example of reactive forms and transform the other one into "Disabling datepicker and custom dates" section. |
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 think you also should update your code to fill recent arrangement on private
fields and methods naming convention (_
prefix)
@@ -453,7 +417,15 @@ export class DatetimePickerComponent implements OnInit, OnDestroy, ControlValueA | |||
private isModelValid(fdDateTime: FdDatetime): boolean { | |||
return fdDateTime && | |||
fdDateTime instanceof FdDatetime && | |||
fdDateTime.isDateValid() && fdDateTime.isTimeValid(); | |||
this.isDateValid(fdDateTime) && fdDateTime.isTimeValid(); |
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.
New line
this.isDateValid(fdDateTime) && fdDateTime.isTimeValid(); | |
this.isDateValid(fdDateTime) && | |
fdDateTime.isTimeValid(); |
@salarenko All of the changes are included, I added |
I couldn't agree more! We need to clarify to the users which example is for what in a quick glance |
…ction by inputs (#1787) * (core) Datepicker and DateTimePicker: Respect disabled/block function on input type, in datepicker and datetimepicker * Fix Typo * Revert Changes on FdDate model, remove unused code on example * Fix typos, change comments * Add new example with disabled, apply PR comments * Add example for single datepicker and change range datepicker example
Please provide a link to the associated issue.
fixes: #1627
Please provide a brief summary of this pull request.
There is special behaviour for
Date Picker
andDatetime Picker
, which doesn't allow to pick disabled or blocked date by writing it in input. Before it was completely allowed.I also tried to follow behaviour from https://sapui5.hana.ondemand.com/#/entity/sap.m.DatePicker/sample/sap.m.sample.DatePicker
I also removed useless inputs form DateTimePicker
Please check whether the PR fulfills the following requirements
https://github.com/SAP/fundamental-ngx/blob/master/CONTRIBUTING.md
Documentation checklist:
README.md