diff --git a/client/src/app/notes/note.service.ts b/client/src/app/notes/note.service.ts index 5c97eda..6e456f2 100644 --- a/client/src/app/notes/note.service.ts +++ b/client/src/app/notes/note.service.ts @@ -37,10 +37,18 @@ export class NoteService { // Create a date object with the current time const now: Date = new Date(); // Create an array with the current month, day and time + if (now.getHours() > 12) { + const date: Array = [ String(now.getMonth() + 1), String(now.getDate()), String(now.getFullYear()) ]; + // Create an array with the current hour, minute and second + const time: Array = [ String(now.getHours() - 12), String(now.getMinutes()), String(now.getSeconds())]; + // Return the formatted string + return date.join('-') + ' P.M.' + ' ' + time.join(':'); + } else { const date: Array = [ String(now.getMonth() + 1), String(now.getDate()), String(now.getFullYear()) ]; // Create an array with the current hour, minute and second const time: Array = [ String(now.getHours()), String(now.getMinutes()), String(now.getSeconds())]; // Return the formatted string - return date.join('-') + ' ' + time.join(':'); + return date.join('-') + ' A.M.' + ' ' + time.join(':'); } } +}