I have a NgbDateStruct object in my TypeScript file, and I need to convert it into a string of the format "YYYY-MM-DD".
currentDate: NgbDateStruct;
When I check console.log(this.currentDate), I see that it is displaying a Moment object.
console.log(this.currentDate);
Moment {_isAMomentObject: true, _i: '2021-12-1', _f: 'YYYY-MM-DD', _isUTC: false, _pf: {…}, …} _d: Wed Dec 01 2021 00:00:00 GMT+0800 (Singapore Standard Time) {} _f: "YYYY-MM-DD" _i: "2021-12-1" _isAMomentObject: true _isUTC: false _isValid: true _locale: Locale {_calendar: {…}, _longDateFormat: {…}, _invalidDate: 'Invalid date', _dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: ƒ, …} _pf: {empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -1, charsLeftOver: 0, …} [[Prototype]]: Object
Is there a way for me to extract the format "YYYY-MM-DD" from this existing object shown in the console.log?