Delete parseTime.js
This commit is contained in:
parent
842a425533
commit
1800a22fb4
|
@ -1,20 +0,0 @@
|
|||
const parseTime = (dateStr, timeStr) => {
|
||||
if (/-/.exec(timeStr)) {
|
||||
console.error(`${timeStr} has date a range`);
|
||||
return;
|
||||
}
|
||||
|
||||
timeStr = timeStr.toUpperCase() // converting cases like 7PM to 7PM
|
||||
if (/[0-9](a|A|p|P)/g.exec(timeStr)) { // converting cases like 7PM to 7 PM
|
||||
timeStr = timeStr.replace(/[0-9](?=(a|A|p|P))/g, "$& ");
|
||||
}
|
||||
if (/(?<!:[0-9])[0-9] (a|A|p|P)/g.exec(timeStr)) { // converting cases like 7 PM to 7:00 PM
|
||||
timeStr = timeStr.replace(/[0-9](?= )/, "$&:00");
|
||||
}
|
||||
|
||||
let date = new Date(`${dateStr} ${timeStr}`); // convert from CST to EST
|
||||
date.setHours(date.getHours() + 1);
|
||||
|
||||
console.log(date.toString());
|
||||
return date;
|
||||
}
|
Loading…
Reference in New Issue