Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onChangeHour: function (ev, value) {
const currentTime = DateFactory(value).getTimeExtended();
const currentHour = value.hour;
value.hour = ev.value;
// In the case of navigating onto the skipped hour of DST, ilib will return the same
// value so we skip that hour and update the value again.
const newTime = DateFactory(value).getTimeExtended();
if (newTime === currentTime) {
value.hour = ev.value * 2 - currentHour;
}
return value;
},
toIDate (time) {
if (time && this.props.locale) {
return DateFactory({
unixtime: time,
timezone: 'local'
});
}
}
updateValue = (value) => {
const {day, month, year} = value;
const maxDays = value.cal.getMonLength(month, year);
value.day = (day <= maxDays) ? day : maxDays;
const date = DateFactory(value);
const newValue = date.getTimeExtended();
const changed = this.props.value == null || this.props.value !== newValue;
this.setState({
value: newValue
});
if (changed) {
this.emitChange(date);
}
return newValue;
}
const toLocalYear = (year) => {
return DateFactory({
julianday: DateFactory({
year,
type: 'gregorian',
month: 1,
day: 1,
timezone: 'local'
}).getJulianDay(),
timezone: 'local'
}).getYears();
};
const toLocalYear = (year) => {
return DateFactory({
julianday: DateFactory({
year,
type: 'gregorian',
month: 1,
day: 1,
timezone: 'local'
}).getJulianDay(),
timezone: 'local'
}).getYears();
};