ant-design/components/date-picker/demo/locale.md

32 lines
568 B
Markdown
Raw Normal View History

# 国际化
- order: 10
2015-11-16 14:10:42 +08:00
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
---
````jsx
import { DatePicker } from 'antd';
import enUS from 'antd/lib/date-picker/locale/en_US';
import assign from 'object-assign';
const App = React.createClass({
getInitialState() {
return {
2015-11-16 16:12:39 +08:00
locale: assign({}, enUS, {
timezoneOffset: 0 * 60,
firstDayOfWeek: 0,
2015-12-25 01:44:06 +08:00
minimalDaysInFirstWeek: 1,
2015-11-16 16:12:39 +08:00
})
};
},
render() {
return <DatePicker locale={this.state.locale} />;
}
});
ReactDOM.render(<App />, mountNode);
````