Skip to content

Commit

Permalink
fix(components): when backing to picker keeping time selected before
Browse files Browse the repository at this point in the history
Fixing bug to keep the date and time selected when back to picker.

ISSUES CLOSED: 207374
  • Loading branch information
Rodrigo Xavier committed Oct 27, 2020
1 parent 490a9c5 commit 27c9aee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/blipDaterangepicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export class BlipDaterangepicker extends Component {
</div>
</div>`

const today = new Date()
const lastMonth = DateHelper.moveMonth(today, -1)
const startDate = (this._selectedPeriod && this._selectedPeriod.startDate) || DateHelper.moveMonth(new Date(), -1)
const endDate = (this._selectedPeriod && this._selectedPeriod.endDate) || new Date()

const datepickerContainer = daterangepicker.querySelector(`.${datepickerContainerClass}`)
datepickerContainer.appendChild(this._leftPicker.render(lastMonth))
datepickerContainer.appendChild(this._rightPicker.render(today))
datepickerContainer.appendChild(this._leftPicker.render(startDate))
datepickerContainer.appendChild(this._rightPicker.render(endDate))

this._daterangepicker = daterangepicker
this.inputContainer = daterangepicker.querySelector(`.${inputContainerClass}`)
Expand Down

0 comments on commit 27c9aee

Please sign in to comment.