I've been building an app that needs to work internationally. In this app, I'm using the Bootstrap Datepicker. I am able to successfully initializing a date picker using the following:
<input id="myDatePicker" class="form-control input-sm" type="text" autocomplete="off" value="">
$('#myDatePicker').datepicker({
autoclose: true,
clearBtn: true,
language: 'zh-CN',
startDate: '01/01/1900',
todayHighlight: true
});
When a user chooses a date, it correctly gets displayed in Chinese. My problem is, sometimes when the page loads, I need to pre-select the date. If I wanted myDatePicker
to already be selected to June 1, in Chinese, what value do I need to put in the value
attribute of the input
element.
Due to the way the code is structured, I cannot set the value in the .datepicker
initialization code. I need to set the value in the value
attribute of the input
element.
Thank you
From what the docs say here the following format is acceptable:
"06-01-2012"
Making your HTML look like so: