Revert "docs: update moment locale usage"

This reverts commit 89228118af.

The original purpose to import locale from src is that some projects
adding `jsnext:main` to the `resolve.mainFields` config of webpack which leads
webpack load moment from `src/moment.js`. But import from `locale`
should works for most projects.
This commit is contained in:
Wei Zhu 2018-07-11 15:17:15 +08:00
parent e3ef74c3e7
commit 4b045fc43f
4 changed files with 3 additions and 8 deletions

View File

@ -36,8 +36,7 @@ import locale from 'antd/lib/date-picker/locale/zh_CN';
```jsx
// The default locale is en-US, if you want to use other locale, just set locale in entry file globaly.
import moment from 'moment';
import 'moment/src/locale/zh-cn';
// import 'moment/locale/zh-cn'; if you are using webpack 1
import 'moment/locale/zh-cn';
<DatePicker defaultValue={moment('2015-01-01', 'YYYY-MM-DD')} />
```

View File

@ -37,8 +37,7 @@ import locale from 'antd/lib/date-picker/locale/zh_CN';
```jsx
// 默认语言为 en-US如果你需要设置其他语言推荐在入口文件全局设置 locale
import moment from 'moment';
import 'moment/src/locale/zh-cn';
// import 'moment/locale/zh-cn'; if you are using webpack 1
mport 'moment/locale/zh-cn';
<DatePicker defaultValue={moment('2015-01-01', 'YYYY-MM-DD')} />
```

View File

@ -14,8 +14,7 @@ title: LocaleProvider
```jsx
import { LocaleProvider } from 'antd';
import fr_FR from 'antd/lib/locale-provider/fr_FR';
import 'moment/src/locale/fr';
// import 'moment/locale/fr'; if you are using webpack 1
import 'moment/locale/fr';
...

View File

@ -16,8 +16,6 @@ LocaleProvider 使用 React 的 [context](https://facebook.github.io/react/docs/
import { LocaleProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import 'moment/locale/zh-cn';
// import 'moment/locale/zh-cn'; if you are using webpack 1
...
return <LocaleProvider locale={zh_CN}><App /></LocaleProvider>;