title: Angular Material datepicker + moment, serializing the moment objects for backend?
body: <p>I have a date picker using the moment adapter with the locale, all is ok with the dates but I can't get convert them on the backend. I'm getting it from the form using <code>formGroup.value</code></p>
  
  <p>Before sending it to the backend (via angular firebase) it looks like: </p>
  
  <pre><code>from: Moment
  _d: Sat Jul 06 2019 01:00:00 GMT+0100 (British Summer Time) {}
  _i: {year: 2019, month: 6, date: 6}
  _isAMomentObject: true
  _isUTC: true
  _isValid: true
  _locale: Locale {_calendar: {…}, _longDateFormat: {…}, _invalidDate: "Invalid date", ordinal: ƒ, _dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, …}
  _offset: 0
  _pf: {empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -1, charsLeftOver: 0, …}
  __proto__: Object
  </code></pre>
  
  <p>But on the backend logging it, looks like: </p>
  
  <pre><code>from:
  &gt;        { _isAMomentObject: true,
  &gt;          _i: [Object],
  &gt;          _isUTC: true,
  &gt;          _pf: [Object],
  &gt;          _locale: [Object],
  &gt;          _d: {},
  &gt;          _isValid: true,
  &gt;          _offset: 0 },
  </code></pre>
  
  <p>with the values empty and of course TypeErrors are thrown when I try to get any kind of date from it. </p>
  
  <p>I'm sending it via <code>@angular/fire</code> as a httpCallable function.</p>
  
  <p>EDIT: Current workaround which is rather hacky/unpreffered: </p>
  
  <pre><code>    let oldFrom: moment.Moment = this.from.value;
      let oldTo: moment.Moment = this.to.value;
      this.ReportForm.controls.from.setValue(oldFrom.toISOString());
      this.ReportForm.controls.to.setValue(oldTo.toISOString());
      this.submitted.emit(this.ReportForm.value);
      this.ReportForm.controls.from.setValue(oldFrom);
      this.ReportForm.controls.to.setValue(oldTo);
  </code></pre>
  
  <p>I need to change it back to a moment object otherwsie they'll stop working for all future dates.</p>