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,
|
props: WidgetProps,
|
||||||
dataTree?: DataTree,
|
dataTree?: DataTree,
|
||||||
) => ValidationResponse;
|
) => ValidationResponse;
|
||||||
|
|
||||||
|
export const ISO_DATE_FORMAT = "YYYY-MM-DDTHH:mm:ss.SSSZ";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import {
|
import {
|
||||||
|
ISO_DATE_FORMAT,
|
||||||
VALIDATION_TYPES,
|
VALIDATION_TYPES,
|
||||||
ValidationResponse,
|
ValidationResponse,
|
||||||
ValidationType,
|
ValidationType,
|
||||||
|
|
@ -392,8 +393,8 @@ export const VALIDATORS: Record<ValidationType, Validator> = {
|
||||||
.minute(0)
|
.minute(0)
|
||||||
.second(0)
|
.second(0)
|
||||||
.millisecond(0);
|
.millisecond(0);
|
||||||
const dateFormat = props.dateFormat ? props.dateFormat : moment.ISO_8601;
|
const dateFormat = props.dateFormat ? props.dateFormat : ISO_DATE_FORMAT;
|
||||||
// const dateStr = moment().toISOString();
|
|
||||||
const todayDateString = today.format(dateFormat);
|
const todayDateString = today.format(dateFormat);
|
||||||
if (dateString === undefined) {
|
if (dateString === undefined) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user