Skip to content

Commit

Permalink
Re-write timestamp field to use date related call #2
Browse files Browse the repository at this point in the history
Re-wrote the timestamp field to use a call on a date object to grab the date and time.
  • Loading branch information
Jack Perala committed Apr 6, 2020
1 parent ee47617 commit 00c2ee5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/src/app/notes/add-note.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ModuleWithComponentFactories } from '@angular/core';
import { Note } from './note';
import { NoteService } from './note.service';
import { MatSnackBar } from '@angular/material/snack-bar';
Expand Down Expand Up @@ -63,13 +63,14 @@ export class AddNoteComponent implements OnInit {

const currentDate = new Date();
const newDate = new Date(currentDate.setHours(currentDate.getHours() + 5));
const timeStampDate = new Date();

const newNote: Note = {
owner_id: this.id,
_id: undefined,
message: formResults.message,
expiration: newDate.toISOString(),
timestamp: this.timestamp,
timestamp: timeStampDate.toLocaleString('en-US'),
};

this.noteService.addNote(this.id, newNote).subscribe((newID) => {
Expand Down

0 comments on commit 00c2ee5

Please sign in to comment.