Skip to content

Commit

Permalink
Analytics: Fix advanced filtering date selection in WordPress 6.1. (w…
Browse files Browse the repository at this point in the history
…oocommerce#35644)

* Fixed date filter date selection in WordPress 6.1.

* Move fix deeper into DatePicker itself.
  • Loading branch information
Matt Sherman authored Nov 22, 2022
1 parent 6ac092e commit 995b587
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/js/components/changelog/fix-datepicker-moment
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fixed DatePicker to work in WordPress 6.1 when currentDate is set to a moment instance.
6 changes: 5 additions & 1 deletion packages/js/components/src/calendar/date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ class DatePicker extends Component {
</H>
<div className="woocommerce-calendar__react-dates is-core-datepicker">
<WpDatePicker
currentDate={ date }
currentDate={
date instanceof moment
? date.toDate()
: date
}
onChange={ partial(
this.onDateChange,
onToggle
Expand Down

0 comments on commit 995b587

Please sign in to comment.