Datepicker format

I would like to suggest a custom format for the date in an input field when using the NgbDatepicker. This seems to be an important feature especially for people of countries who are used to the reverse format of the standard “datetime”.

An option like

<input ... [format]="" ... >

would probably already suffice most use cases.

Sorry in case this has already been posted. Thanks!

1 possible answer(s) on “Datepicker format

1 possible answer(s) on “DatePicker format

  1. You need to pass a function that takes a Date and returns a String:

      return date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate();
      return <DatePicker formatDate={this.formatDate} />;

    EDIT: fixed formatting