Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getBaseDateForRendering (defaultValue, locale, timezone, value) {
let baseDate
const baseValue = value || defaultValue
if (baseValue) {
baseDate = DateTime.parse(baseValue, locale, timezone)
} else {
baseDate = DateTime.now(locale, timezone)
}
return baseDate.second(0).millisecond(0)
}
constructor (props, context) {
super(props, context)
const locale = this._locale(props, context)
const timezone = this._timezone(props, context)
const defaultTodayValue = DateTime.now(locale, timezone)
.hour(0)
.minute(0)
.second(0)
.millisecond(0)
.format()
const todayValue = this._validateDateProp(
props.todayValue,
defaultTodayValue,
'todayValue',
locale,
timezone
)
const selectedValue = this._validateDateProp(
props.selectedValue || props.defaultSelectedValue,
get calendarSelectedValue () {
const { acceptedValue } = this.state
let value = acceptedValue ? this.parseDate(acceptedValue) : undefined
if (!value || !value.isValid()) {
value = DateTime.now(this.locale, this.timezone)
}
return value.toISOString(true)
}