I am currently working on a project using Angular and Material2.
Within this project, I have created a moment object in the following way:
myDate = moment.utc(new Date()).format("YYYY-MM-DD HH:mm:ss")
;This object is then passed as an argument to another function that requires the formatted date string.
Upon inspecting this object, I noticed it has properties: _f: YYYY-MM-DD HH:mm:ss"
and _i: "2018-01-17 13:51:54"
Is there a method through which I could retrieve the value of _f
or _i
?
EDIT:
Ultimately, my goal is to obtain "2018-01-17 13:51:54"
rather than _f
or _i
.
EDIT2:
Within that function, myDate functions as a Moment object. Specifically, I am extending MomentDateAdapter and overriding
format(date: Moment, displayFormat: string): string {}
. Therefore, date IS a Moment object. This is utilized within Material2 Datepicker.
EDIT3 - some findings:
toString:
Wed Jan 17 2018 14:10:53 GMT+0100
format:
2018-01-17T14:10:53+01:00
toISOString:
2018-01-17T13:10:53.000Z