简体   繁体   中英

How to localize date picker calendar based on country/region?

I am working on html web page to get user detail. User first enters country and then selects date using date picker. I have used the following code using date picker.

protected SetDate(id: string) {
     $("#SomeID").datepicker({
     dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
     monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
     // In japanese
     monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
     dateFormat: 'yy/mm/dd',
     changeMonth: true,
     changeYear: true,
        });
    }

How can I localize date picker calendar as per user selected the country or using TS code?

Datepicker plugin does exactly what you want if I understood correctly.

You have an exemple here => DatePicker Localization Documentation

More detailed documentation about localization

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM