Skip to content

Commit

Permalink
Rename isValid -> isValidDate
Browse files Browse the repository at this point in the history
  • Loading branch information
Dammmien committed Apr 14, 2018
1 parent 89edc13 commit 0c46805
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/EditorWidgets/Date/DateControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export default class DateControl extends React.Component {

// Date is valid if datetime is a moment or Date object otherwise it's a string.
// Handle the empty case, if the user wants to empty the field.
isValid = datetime => (moment.isMoment(datetime) || datetime instanceof Date || datetime === '');
isValidDate = datetime => (moment.isMoment(datetime) || datetime instanceof Date || datetime === '');

handleChange = datetime => {
const { onChange } = this.props;

// Set the date only if the format is valid
if (this.isValid(datetime)) {
if (this.isValidDate(datetime)) {
const formattedValue = moment(datetime).format(this.format);
onChange(formattedValue);
}
Expand All @@ -51,7 +51,7 @@ export default class DateControl extends React.Component {
onBlur = datetime => {
const { setInactiveStyle, onChange } = this.props;

if (!this.isValid(datetime)) {
if (!this.isValidDate(datetime)) {
const parsedDate = moment(datetime);

if (parsedDate.isValid()) {
Expand Down

0 comments on commit 0c46805

Please sign in to comment.