Skip to content

How to change calendar's language?

Fetrarijaona R edited this page Feb 4, 2019 · 1 revision

To change language on the calendar, use moment.locale(YOUR_LANG); in your component, then pass locale'values in the attribute locale.

Example for french:

import * as moment from 'moment';
moment.locale('fr');
@Component({
  selector: 'simple',
  templateUrl: './simple.component.html',
  styleUrls: ['./simple.component.scss']
})
export class SimpleComponent implements OnInit {
  locale = {
   daysOfWeek: moment.weekdaysMin(),
   monthNames: moment.monthsShort(),
   firstDay: moment.localeData().firstDayOfWeek()
  };
  ...
}

and html:

<input type="text" ngxDaterangepickerMd
    [(ngModel)]="selected" class="form-control" placeholder="Choose date"
    [locale]="locale">
Clone this wiki locally