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

select only to-date in rangeMode #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
Expand Up @@ -64,7 +64,7 @@ export class OwlDateTimeContainerComponent<T>
// retain start and end time
private retainStartTime: T;
private retainEndTime: T;

/**
* Stream emits when try to hide picker
* */
Expand Down Expand Up @@ -417,16 +417,20 @@ export class OwlDateTimeContainerComponent<T>
return null;
}

// if the given calendar day is after or equal to 'from',
// set ths given date as 'to'
// if the given calendar day is after or equal to 'from' or this is the first selected date but activeSelectedIndex was set by user
// set the given date as 'to'
// otherwise, set it as 'from' and set 'to' to null
if (this.picker.selectMode === 'range') {
if (
this.picker.selecteds &&
this.picker.selecteds.length &&
!to &&
from &&
this.dateTimeAdapter.differenceInCalendarDays(result, from) >= 0
(this.picker.selecteds &&
this.picker.selecteds.length &&
!to &&
from &&
this.dateTimeAdapter.differenceInCalendarDays(
result,
from
) >= 0) ||
(!to && !from && this.activeSelectedIndex === 1)
) {
if (this.picker.endAt && !this.retainEndTime) {
to = this.dateTimeAdapter.createDate(
Expand Down