I use this method in order to convert a date string to a javascript date object:
function convertToDateOrUndefined(dateString) {
if (dateString instanceof Date || dateString == null) {
return undefined;
}
return new Date(dateString.replace(/(\d{2})\.(\d{2})\.(\d{4})/,'$3-$2-$1'));
}
Currently I have this dateTime string 'dd.MM.yyyy HH:mm' and I would need also a function to convert this string into a js date obejct. I am not really good in regex therefore I would need help - Thanks!