From d0d7a04b18ba317fa6bcd952fcb2a4a1840a5744 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 13 Oct 2016 17:53:10 +0800 Subject: [PATCH] docs: update change log, close: #3347 --- CHANGELOG.en-US.md | 8 +++++++- CHANGELOG.zh-CN.md | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 14a59731c7..60eef8985f 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -58,7 +58,12 @@ There are some breaking changes in `antd@2.0.0`, and you need to modify your cod - + ``` -* Parameters of type `Date/GregorianCalendar` of functions such as `onChange` and `onPanelChange`, plus other callback functions had been changed to type moment. Please consult [APIs of gregorian-calendar](https://github.com/yiminghe/gregorian-calendar) and [APIs of moment](http://momentjs.com/docs/), and update your code accordingly. Because the return value of `JSON.stringy(date: moment)` will lost time zone, we should use `.format` to convert date to string first, see related issue [#3082](https://github.com/ant-design/ant-design/issues/3082) for details: +* Parameters of type `Date/GregorianCalendar` of functions such as `onChange` and `onPanelChange`, plus other callback functions had been changed to type moment. Please consult [APIs of gregorian-calendar](https://github.com/yiminghe/gregorian-calendar) and [APIs of moment](http://momentjs.com/docs/), and update your code accordingly. And the difference between GregorianCalendar's and moment's APIs(not a completed list): + ```jsx + time.getTime() => time.valueOf(); + ``` + + Because the return value of `JSON.stringy(date: moment)` will lost time zone, we should use `.format` to convert date to string first, see related issue [#3082](https://github.com/ant-design/ant-design/issues/3082) for details: ```js handleSubmit() { const values = this.props.form.getFieldsValue(); @@ -67,6 +72,7 @@ There are some breaking changes in `antd@2.0.0`, and you need to modify your cod // send data to server } ``` +* For the value of time-related components becomes an instance of `moment`, you should replace `type='date'` with `type='object'` in form validation. * The `format` of time-related components is changed from [gregorian-calendar-format](https://github.com/yiminghe/gregorian-calendar-format#api) to [moment format](http://momentjs.com/docs/#/parsing/string-format/) now, for instance the format `yyyy-MM-dd` should change to `YYYY-MM-DD`. * `linkRender` and `nameRender` of Breadcrumb are removed, please use `itemRender`. * `onClose` and `onOpen` of Menu are removed, please use `onOpenChange`. As being totally different, please check [this demo](http://beta.ant.design/components/menu/#components-menu-demo-sider-current) first. diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 38d7f3f089..192b243e93 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -56,7 +56,12 @@ timeline: true - + ``` -* 时间类组件的 `onChange` 和 `onPanelChange` 及其他回调函数中为 `Date/GregorianCalendar` 类型的参数,均修改为 moment 类型,两者 API 有所不同,但功能基本一致,请对照 [moment 的 API 文档](http://momentjs.com/docs/) 和 [gregorian-calendar 的文档](https://github.com/yiminghe/gregorian-calendar) 进行修改。由于 `JSON.stringy(date: moment)` 返回的值会丢失时区设置,所以要先使用 `.format` 把日期转成字符串,相关 issue 见 [#3082](https://github.com/ant-design/ant-design/issues/3082): +* 时间类组件的 `onChange` 和 `onPanelChange` 及其他回调函数中为 `Date/GregorianCalendar` 类型的参数,均修改为 moment 类型,两者 API 有所不同,但功能基本一致,请对照 [moment 的 API 文档](http://momentjs.com/docs/) 和 [gregorian-calendar 的文档](https://github.com/yiminghe/gregorian-calendar) 进行修改。GregorianCalendar 的 API 与 moment API 的对应关系,不完全列举: + ```jsx + time.getTime() => time.valueOf() + ``` + + 由于 `JSON.stringy(date: moment)` 返回的值会丢失时区设置,所以要先使用 `.format` 把日期转成字符串,相关 issue 见 [#3082](https://github.com/ant-design/ant-design/issues/3082): ```js handleSubmit() { const values = this.props.form.getFieldsValue(); @@ -65,6 +70,8 @@ timeline: true // 发送 data 到服务器 } ``` + +* 时间类组件与表单校验一起使用时,`type='date'` 改为 `type='object'`。 * 时间类组件的 `format` 属性也发生了变化,从 [gregorian-calendar-format 的格式](https://github.com/yiminghe/gregorian-calendar-format#api) 变化为与 [moment 的格式](http://momentjs.com/docs/#/parsing/string-format/),例如原来的 `yyyy-MM-dd` 将变为 `YYYY-MM-DD`。 * Breadcrumb 移除 `linkRender` 和 `nameRender`,请使用 `itemRender`。 * Menu 移除 `onClose` `onOpen`,请使用 `onOpenChange`。API 差异较大,请先研究 [demo](http://beta.ant.design/components/menu/#components-menu-demo-sider-current)。