datepicker 2 migration 27 added, default response udpated (#5393)

Default Min and Max Date were showing errors, We have fixed it now. This was specific to safari
This commit is contained in:
Bhavin K 2021-07-16 12:34:11 +05:30 committed by GitHub
parent 4ddc430411
commit 374e8aec4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 2 deletions

View File

@ -138,8 +138,8 @@ const WidgetConfigResponse: WidgetConfigReducerState = {
columns: 5 * GRID_DENSITY_MIGRATION_V1,
widgetName: "DatePicker",
defaultDate: moment().toISOString(),
minDate: "2001-01-01 00:00",
maxDate: "2041-12-31 23:59",
minDate: "1920-12-31T18:30:00.000Z",
maxDate: "2121-12-31T18:29:00.000Z",
version: 2,
isRequired: false,
},

View File

@ -787,7 +787,11 @@ const transformDSL = (currentDSL: ContainerWidgetProps<WidgetProps>) => {
currentDSL = migrateItemsToListDataInListWidget(currentDSL);
currentDSL.version = 26;
}
if (currentDSL.version === 26) {
currentDSL = migrateDatePickerMinMaxDate(currentDSL);
}
if (currentDSL.version === 27) {
currentDSL = migrateFilterValueForDropDownWidget(currentDSL);
currentDSL.version = LATEST_PAGE_VERSION;
}
@ -795,6 +799,30 @@ const transformDSL = (currentDSL: ContainerWidgetProps<WidgetProps>) => {
return currentDSL;
};
const migrateDatePickerMinMaxDate = (
currentDSL: ContainerWidgetProps<WidgetProps>,
) => {
if (
currentDSL.type === WidgetTypes.DATE_PICKER_WIDGET2 &&
currentDSL.version === 2
) {
if (currentDSL.minDate === "2001-01-01 00:00") {
currentDSL.minDate = "1920-12-31T18:30:00.000Z";
}
if (currentDSL.maxDate === "2041-12-31 23:59") {
currentDSL.maxDate = "2121-12-31T18:29:00.000Z";
}
}
if (currentDSL.children && currentDSL.children.length) {
currentDSL.children.map(
(eachWidgetDSL: ContainerWidgetProps<WidgetProps>) => {
migrateDatePickerMinMaxDate(eachWidgetDSL);
},
);
}
return currentDSL;
};
const addFilterDefaultValue = (
currentDSL: ContainerWidgetProps<WidgetProps>,
) => {