mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-21 23:42:21 +03:00
Check provided date
This commit is contained in:
parent
ce40aa342b
commit
0da88a7729
1 changed files with 8 additions and 3 deletions
|
@ -365,16 +365,21 @@ window.GeneralFunctions = window.GeneralFunctions || {};
|
|||
var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
|
||||
var hours = addHours ? ' ' + timeFormat : '';
|
||||
var result;
|
||||
var parsedDate = Date.parse(date);
|
||||
|
||||
if (!parsedDate) {
|
||||
return date;
|
||||
}
|
||||
|
||||
switch (dateFormatSetting) {
|
||||
case 'DMY':
|
||||
result = Date.parse(date).toString('dd/MM/yyyy' + hours);
|
||||
result = parsedDate.toString('dd/MM/yyyy' + hours);
|
||||
break;
|
||||
case 'MDY':
|
||||
result = Date.parse(date).toString('MM/dd/yyyy' + hours);
|
||||
result = parsedDate.toString('MM/dd/yyyy' + hours);
|
||||
break;
|
||||
case 'YMD':
|
||||
result = Date.parse(date).toString('yyyy/MM/dd' + hours);
|
||||
result = parsedDate.toString('yyyy/MM/dd' + hours);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Invalid date format setting provided!', dateFormatSetting);
|
||||
|
|
Loading…
Reference in a new issue