Skip to content

Commit

Permalink
fix(core/calendar): value not set with daily period objects
Browse files Browse the repository at this point in the history
  • Loading branch information
trik committed Jan 16, 2020
1 parent 5e2c6c6 commit 571f7c1
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/core/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,15 @@ export abstract class AjfCalendar implements AfterContentInit, ControlValueAcces
return this._selectedPeriod;
}
set value(period: AjfCalendarPeriod | Date | null) {
if (this._dateOnlyForDay && this.selectionMode === 'day') {
if (period instanceof Date &&
(this._selectedPeriod == null || period !== this._selectedPeriod.startDate)) {
this.selectedPeriod = {
type: 'day',
startDate: period,
endDate: period
};
this._onChangeCallback(period);
}
if (
this._dateOnlyForDay && this.selectionMode === 'day' && period instanceof Date
&& (this._selectedPeriod == null || period !== this._selectedPeriod.startDate)
) {
this.selectedPeriod = {
type: 'day',
startDate: period,
endDate: period
};
} else if (period instanceof Object && period !== this._selectedPeriod) {
this.selectedPeriod = <AjfCalendarPeriod>period;
this._onChangeCallback(period);
Expand Down

0 comments on commit 571f7c1

Please sign in to comment.