Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parseISO (iso = '', locale = this.locale, timezone = this.timezone) {
const parsed = DateTime.parse(iso, locale, timezone)
if (parsed.isValid()) {
return {
iso: parsed.toISOString(true),
message: {
type: 'success',
text: parsed.format(this.props.messageFormat),
},
}
}
return {
iso: undefined,
message: iso ? this.getErrorMessage(...iso.split('T')) : null,
}
}
_parseDate (dateStr, locale, timezone) {
return DateTime.parse(dateStr, locale, timezone)
}
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)
}
_parseDate (dateStr, locale, timezone) {
return DateTime.parse(dateStr, locale, timezone)
}
getSelectedOption (format, locale, timezone, value) {
if (!value) {
return
}
const date = DateTime.parse(value, locale, timezone)
return {
value: date.toISOString(),
label: date.format(format)
}
}