Datepicker plugin locale


#1

I am trying to set locale for datepicker plugin on Android, but the locale still English, Here is my code,

    this.datePicker.show({
      date: new Date(),
      mode: 'date',
      androidTheme: 4,
      titleText: "To Date",
      locale: 'ar',
      okText: 'تم',
      doneButtonColor: '#F2F3F4',
      cancelText: 'الغاء'
      // androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_DARK
    }).then(
      date => {
        console.log('Got date: ', date);
        this.periodeTo = date;
        debugger;
      },
      err => {
        console.log('Error occurred while getting date: ', err);
        debugger;
      });

Your help is much appreciated.


#2

i have the same Problem. do you already solve this locale Problem ?


#3

@justo90 there is a big issue with datepicker on android, i used in my app a code that has been discussed on this forums to auto set the default date time according to the user.
There are 2 flavours on this, try to use the default browser javascript time, or add a javascript library that is more accure, but add another .js file to load in your project as a dependency.

One of the issue is to automatically set the today date, to an input in a page. It’s not so easy because of the locales.

See the the topic there:

(DateTime - default to todays date)`

The initial discussion was to set the date in the app to today date.

Hope it helps,