Fixes date widget crashing when no date format is mentioned (#322)
Fixed by using a proper default format string for ISO dates
This commit is contained in:
parent
cbc4796921
commit
855fc1c00a
|
|
@ -33,3 +33,5 @@ export type Validator = (
|
|||
props: WidgetProps,
|
||||
dataTree?: DataTree,
|
||||
) => ValidationResponse;
|
||||
|
||||
export const ISO_DATE_FORMAT = "YYYY-MM-DDTHH:mm:ss.SSSZ";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import _ from "lodash";
|
||||
import {
|
||||
ISO_DATE_FORMAT,
|
||||
VALIDATION_TYPES,
|
||||
ValidationResponse,
|
||||
ValidationType,
|
||||
|
|
@ -392,8 +393,8 @@ export const VALIDATORS: Record<ValidationType, Validator> = {
|
|||
.minute(0)
|
||||
.second(0)
|
||||
.millisecond(0);
|
||||
const dateFormat = props.dateFormat ? props.dateFormat : moment.ISO_8601;
|
||||
// const dateStr = moment().toISOString();
|
||||
const dateFormat = props.dateFormat ? props.dateFormat : ISO_DATE_FORMAT;
|
||||
|
||||
const todayDateString = today.format(dateFormat);
|
||||
if (dateString === undefined) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user