Skip to content

Commit

Permalink
Merge pull request #1 from dargonwanglong/MAX-32513
Browse files Browse the repository at this point in the history
MAX-32513 Fix Range Picker Issues
  • Loading branch information
dargonwanglong authored Feb 7, 2024
2 parents 806b3b1 + c2c5e5a commit fe290a8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v2.3.2
==================
* Set both From and To to this date, when time is not enabled and only one date is selected on the Calendar Panel.
* Set the left calendar as the month selected from From

v2.3.1
==================
* Fixed vertical paddind and display issue
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "px-datetime-range-panel",
"version": "2.3.1",
"version": "2.3.2",
"main": [
"px-datetime-range-panel.html"
],
Expand Down Expand Up @@ -58,4 +58,4 @@
}
},
"license": "Apache-2.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "px-datetime-range-panel",
"author": "General Electric",
"description": "A Px component",
"version": "2.3.1",
"version": "2.3.2",
"private": false,
"extName": null,
"repository": {
Expand Down
8 changes: 7 additions & 1 deletion px-datetime-range-panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@
//nothing selected, assume it's going to be the start date
if(this.$.fromCalendar.toMoment === null && this.$.toCalendar.toMoment === null && this.$.toCalendar.fromMoment === null) {
this.set('fromMoment', this._preserveTime(this.fromMoment, event.detail));
if(this.hideTime) {
this.set('toMoment', this._preserveTime(this.toMoment, event.detail));
}
} else {

if(this.$.fromCalendar.toMoment) {
Expand Down Expand Up @@ -495,6 +498,9 @@
//nothing selected, assume it's going to be the end date
if(!this.$.fromCalendar.toMoment && !this.$.toCalendar.toMoment && !this.$.fromCalendar.fromMoment) {
this.set('toMoment', this._preserveTime(this.toMoment, event.detail));
if(this.hideTime) {
this.set('fromMoment', this._preserveTime(this.fromMoment, event.detail));
}
} else {
if(this.$.toCalendar.toMoment) {
//range is picked solely on 'to' calendar
Expand Down Expand Up @@ -535,7 +541,7 @@
//make sure the new base date is at least the month before 'to'
if(this.fromBaseDate === null) {return}
if(!this._internalSet && this.fromBaseDate && this.toBaseDate && this.fromBaseDate.isSameOrAfter(this.toBaseDate, 'month')) {
this.set('fromBaseDate', Px.moment.tz(this.toBaseDate, this.timeZone).subtract(1, 'month'));
this.set('toBaseDate', Px.moment.tz(this.fromBaseDate, this.timeZone).add(1, 'month'));
}

//don't allow the 'to' calendar to choose dates before 1 month after 'from' calendar
Expand Down

0 comments on commit fe290a8

Please sign in to comment.