title: german date format for the datepicker of ng-bootstrap
body: <p>I need your help using NgbDateParserFormatter for the datepicker of ng-bootstrap. I need the german format dd.MM.yyyy (for example 31.03.2017).</p>
  
  <p>I have got a <a href="https://plnkr.co/edit/hmabO1xbPkENLiZZHUJn?p=preview" rel="nofollow noreferrer">plunker</a>, but it does not work correctly: </p>
  
  <ul>
  <li>selecting some dates work (selecting for example 17.03.2017 leads to 17.03.2017)</li>
  <li>selecting some dates do not work (selecting 02.09.1937 gets to 01.09.1937)</li>
  <li>typing a date swaps day and month (01.03.2017 gets to 03.01.2017 and 14.03.2017 gets to an empty input due to there is no 03.14.2017)</li>
  </ul>
  
  <p>Here is the code:</p>
  
  <pre><code>import { NgbDateParserFormatter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';
  import { DatePipe } from '@angular/common';
  
  export class CustomNgbDateParserFormatter extends NgbDateParserFormatter {
      datePipe = new DatePipe('de-AT');
      constructor(
          private dateFormatString: string) {
          super();
      }
      format(date: NgbDateStruct): string {
          if (date === null) {
              return '';
          }
          try {
              return this.datePipe.transform(new Date(date.year, date.month - 1, date.day), this.dateFormatString);
          } catch (e) {
              return '';
          }
      }
      parse(value: string): NgbDateStruct {
          let returnVal: NgbDateStruct;
          if (!value) {
              returnVal = null;
          } else {
              try {
                  let dateParts = this.datePipe.transform(value, 'M-d-y').split('-');
                  returnVal = { year: parseInt(dateParts[2]), month: parseInt(dateParts[0]), day: parseInt(dateParts[1]) };
              } catch (e) {
                  returnVal = null;
              }
          }
          return returnVal;
      }
  }
  </code></pre>
  
  <p>Could you help me, please?</p>
  
  <p>Thank you very much for your help.</p>