Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props) {
super(props);
this.state = {
dateTime: DateTimeUtils.createSafeDate(props.value),
isAmbiguousTime: false,
isTimeClarificationOpen: false,
dateFormat: DateUtil.getFormatByLocale(props.intl.locale),
prevPropsValue: props.value,
};
// The dateValue and timeValue variables represent the actual value in the date input and time input respectively.
// They are used to keep track of the currently entered value to determine whether or not the entry is valid.
// Unlike dateValue and timeValue, this.state.dateTime is the internal moment object representing both the date and time as one entity
// It is used for date/time manipulation and used to calculate the missing/ambiguous hour.
// The dateValue and timeValue are tracked outside of the react state to limit the number of renderings that occur.
this.dateValue = DateTimeUtils.formatMomentDateTime(this.state.dateTime, this.state.dateFormat);
this.timeValue = DateTimeUtils.hasTime(this.props.value) ? DateTimeUtils.formatISODateTime(this.props.value, 'HH:mm') : '';
this.isDefaultDateTimeAcceptable = true;
this.handleDateChange = this.handleDateChange.bind(this);
this.handleDateChangeRaw = this.handleDateChangeRaw.bind(this);
this.handleTimeChange = this.handleTimeChange.bind(this);
this.handleOnSelect = this.handleOnSelect.bind(this);
constructor(props) {
super(props);
this.state = {
dateTime: DateTimeUtils.createSafeDate(props.value),
isAmbiguousTime: false,
isTimeClarificationOpen: false,
dateFormat: DateUtil.getFormatByLocale(props.intl.locale),
prevPropsValue: props.value,
};
// The dateValue and timeValue variables represent the actual value in the date input and time input respectively.
// They are used to keep track of the currently entered value to determine whether or not the entry is valid.
// Unlike dateValue and timeValue, this.state.dateTime is the internal moment object representing both the date and time as one entity
// It is used for date/time manipulation and used to calculate the missing/ambiguous hour.
// The dateValue and timeValue are tracked outside of the react state to limit the number of renderings that occur.
this.dateValue = DateTimeUtils.formatMomentDateTime(this.state.dateTime, this.state.dateFormat);
this.timeValue = DateTimeUtils.hasTime(this.props.value) ? DateTimeUtils.formatISODateTime(this.props.value, 'HH:mm') : '';
this.isDefaultDateTimeAcceptable = true;
this.wasOffsetButtonClicked = false;
this.handleDateChange = this.handleDateChange.bind(this);
this.handleDateChangeRaw = this.handleDateChangeRaw.bind(this);
this.handleTimeChange = this.handleTimeChange.bind(this);