Notification for header

This commit was merged in pull request #339.
This commit is contained in:
2023-07-20 10:22:10 +01:00
parent 5257f89acb
commit 87f1a1e3e8
10 changed files with 362 additions and 326 deletions
+17
View File
@@ -0,0 +1,17 @@
export default function formattedDate(dateString) {
const parts = dateString.split(" ");
const datePart = parts[0];
const timePart = parts[1];
const [month, day, year] = datePart.split("-").map(Number);
let [hour, minute] = timePart.slice(0, -2).split(":").map(Number);
// Convert 12-hour time to 24-hour time if necessary
if (timePart.endsWith("PM") && hour !== 12) {
hour += 12;
} else if (timePart.endsWith("AM") && hour === 12) {
hour = 0;
}
return new Date(year, month - 1, day, hour, minute);
}