title: Is it correct to implement a custom NgbDateParserFormatter to change the format of the input value on NgbInputDatepicker?
body: <p>I'm using the datepicker (<a href="https://ng-bootstrap.github.io" rel="noreferrer" title="ng-bootstrap">ng-boostrap</a>) in a popup and I would like to change the date format to <code>dd-mm-yyyy</code>. </p>
  
  <p>It seems that it can be solved by implementing a new <code>NgbDateParserFormatter</code> to replace the default <code>NgbDateISOParserFormatter</code>.</p>
  
  <p>But I was wondering if there is another way.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>A small implementation of <code>NgbDateParserFormatter</code> using Moment.js
  (tested with version 1.0.0-alpha.14 of ng-bootstrap):</p>
  
  <pre><code>import {NgbDateParserFormatter, NgbDateStruct} from '@ng-bootstrap/ng-bootstrap';
  import * as moment from 'moment';
  
  export class NgbDateMomentParserFormatter extends NgbDateParserFormatter {
      constructor(private momentFormat: string) {
          super();
      };
      format(date: NgbDateStruct): string {
          if (date === null) {
              return '';
          }
          let d = moment({ year: date.year, 
                           month: date.month - 1, 
                           date: date.day });
          return d.isValid() ? d.format(this.momentFormat) : '';
      }
  
      parse(value: string): NgbDateStruct {
          if (!value) {
              return null;
          }
          let d = moment(value, this.momentFormat);
          return d.isValid() ? { year: d.year(), 
                                 month: d.month() + 1, 
                                 day: d.date() } : null;
      }
  }
  </code></pre>
  
  <p>And in a module, you include the provider using a factory to indicate the date format as a parameter:</p>
  
  <pre><code>---
  
  @NgModule({
  
    ---
  
    providers: [
      { 
        provide: NgbDateParserFormatter, 
        useFactory: () =&gt; { return new NgbDateMomentParserFormatter("DD-MM-YYYY") } 
      }
    ]
  
    ---
  
  })
  </code></pre>