Code:
let modifiedValue = attribute_value;
let isISOFormat = moment(new Date(attribute_value), moment.ISO_8601, true).isValid();
if (isISOFormat) {
modifiedValue = formatDateShortCustom(moment(attribute_value).toDate());
}
return modifiedValue;
};
In the code above, the attribute value can have
2021-09-29T18:30:00.000Z080921
I want to make sure that when the attribute_value is in (1) format the code
modifiedValue = formatDateShortCustom(moment(attribute_value).toDate());
should execute.
However, this numerical string is also causing the isISOFormat as true hence navigating the formatDateShortCustom method, which I don't want?
Is there anything I am doing wrong?