Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
psealock committed Feb 28, 2019
1 parent f95fb9f commit df62bc9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/filters/advanced/date-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class DateFilter extends Component {
}
}

isInvalidDate( dateString ) {
isFutureDate( dateString ) {
return moment().isBefore( moment( dateString ), 'day' );
}

Expand All @@ -146,7 +146,7 @@ class DateFilter extends Component {
error={ afterError }
onUpdate={ partial( this.onRangeDateChange, 'after' ) }
dateFormat={ dateFormat }
isInvalidDate={ this.isInvalidDate }
isInvalidDate={ this.isFutureDate }
/>
),
before: (
Expand All @@ -156,7 +156,7 @@ class DateFilter extends Component {
error={ beforeError }
onUpdate={ partial( this.onRangeDateChange, 'before' ) }
dateFormat={ dateFormat }
isInvalidDate={ this.isInvalidDate }
isInvalidDate={ this.isFutureDate }
/>
),
span: <span className="separator" />,
Expand All @@ -171,7 +171,7 @@ class DateFilter extends Component {
error={ beforeError }
onUpdate={ this.onSingleDateChange }
dateFormat={ dateFormat }
isInvalidDate={ this.isInvalidDate }
isInvalidDate={ this.isFutureDate }
/>
);
}
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/filters/date/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class DatePickerContent extends Component {
}
}

isFutureDate( dateString ) {
return moment().isBefore( moment( dateString ), 'day' );
}

render() {
const {
period,
Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit df62bc9

Please sign in to comment.