From df62bc92be9c4a39761dbace52a665ba813fce8b Mon Sep 17 00:00:00 2001 From: Paul Sealock Date: Thu, 28 Feb 2019 15:58:08 +1300 Subject: [PATCH] feedback --- packages/components/CHANGELOG.md | 2 +- packages/components/package.json | 2 +- packages/components/src/filters/advanced/date-filter.js | 8 ++++---- packages/components/src/filters/date/content.js | 6 +++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 7324d172c5b..c77554fd695 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.7.0 (Unreleased) +# 2.0.0 (Unreleased) - Calendar: Expose `isInvalidDate` prop to `DatePicker` to indicated invalid days that are not selectable. - Calendar: Expose `isInvalidDate` prop to `DateRange` and remove the `invalidDays` prop. diff --git a/packages/components/package.json b/packages/components/package.json index 500d47028d1..2c7435d123c 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@woocommerce/components", - "version": "1.6.0", + "version": "2.0.0", "description": "UI components for WooCommerce.", "author": "Automattic", "license": "GPL-2.0-or-later", diff --git a/packages/components/src/filters/advanced/date-filter.js b/packages/components/src/filters/advanced/date-filter.js index 1cf96ebb566..eaccecf6662 100644 --- a/packages/components/src/filters/advanced/date-filter.js +++ b/packages/components/src/filters/advanced/date-filter.js @@ -127,7 +127,7 @@ class DateFilter extends Component { } } - isInvalidDate( dateString ) { + isFutureDate( dateString ) { return moment().isBefore( moment( dateString ), 'day' ); } @@ -146,7 +146,7 @@ class DateFilter extends Component { error={ afterError } onUpdate={ partial( this.onRangeDateChange, 'after' ) } dateFormat={ dateFormat } - isInvalidDate={ this.isInvalidDate } + isInvalidDate={ this.isFutureDate } /> ), before: ( @@ -156,7 +156,7 @@ class DateFilter extends Component { error={ beforeError } onUpdate={ partial( this.onRangeDateChange, 'before' ) } dateFormat={ dateFormat } - isInvalidDate={ this.isInvalidDate } + isInvalidDate={ this.isFutureDate } /> ), span: , @@ -171,7 +171,7 @@ class DateFilter extends Component { error={ beforeError } onUpdate={ this.onSingleDateChange } dateFormat={ dateFormat } - isInvalidDate={ this.isInvalidDate } + isInvalidDate={ this.isFutureDate } /> ); } diff --git a/packages/components/src/filters/date/content.js b/packages/components/src/filters/date/content.js index 969a69eaa18..a3f7e3553fc 100644 --- a/packages/components/src/filters/date/content.js +++ b/packages/components/src/filters/date/content.js @@ -37,6 +37,10 @@ class DatePickerContent extends Component { } } + isFutureDate( dateString ) { + return moment().isBefore( moment( dateString ), 'day' ); + } + render() { const { period, @@ -92,7 +96,7 @@ class DatePickerContent extends Component { after={ after } before={ before } onUpdate={ onUpdate } - isInvalidDate={ dateString => moment().isBefore( moment( dateString ), 'day' ) } + isInvalidDate={ this.isFutureDate } focusedInput={ focusedInput } afterText={ afterText } beforeText={ beforeText }