Topic: Angular - Datepicker with locales?

Dominik Tuleweit pro asked 6 years ago


Hi, I'm from Germany. Is it possible to set locales for the datepicker addon to get german monthnames etc., and german date format?

Magdalena Obalska free answered 6 years ago


Hi, here's an example code for changing your datepicker language.
      <form #myForm="ngForm" novalidate> 
        <my-date-picker name="mydate" locale="kk" [options]="myDatePickerOptions" [placeholder]="'Selected date'" [(ngModel)]="model" required></my-date-picker>
      </form>
You can pick one of the following options: en, fr, ja, fi, es, hu, sv, nl, ru, uk, no, tr, pt-br, de, it, it-ch, pl, my, sk, sl, zh-cn, he, ro, ca, id, en-au, am-et, cs, el, kk, th, ko-kr, da, lt, vi, bn, bg, hr, ar and is.

xardonik free answered 6 years ago


Javascript doesn't have locales month/day names. Default language is english and only english names is supported. That's why you have "option" variable. I think the monthLabels is only for long version of name and short version is a first 3 characters of month name

Dominik Tuleweit pro answered 6 years ago


i see, with the options i can set the dateformat. i think that: dayLabelsFull: <IMyDayLabels> {}, dayLabels: <IMyDayLabels> {}, monthLabels: <IMyMonthLabels> {}, can set the month-/daynames? Where is monthLabelsFull? would it not be easier only to set the locale (eg: de_DE) and all the names and formats were set automatically?

xardonik free answered 6 years ago


Did you tru use options from this example? https://mdbootstrap.com/angular/advanced/datepicker/

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags