Skip to content

Commit

Permalink
Fix(Timestamp): Spell TZC in lowercase zc.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 22, 2017
1 parent 8c6b125 commit 063c00e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docs/md/cn/timestamp.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Demo extends Component {
<div><Timestamp format="yyyy" value="Wed Nov 22 2017 02:06:01 GMT+0800 (CST)"/></div>
<div><Timestamp format="MM月" value="Wed Nov 22 2017 02:06:01 GMT+0800 (CST)"/></div>
<div><Timestamp format="dd日" value="Wed Nov 22 2017 02:06:01 GMT+0800 (CST)"/></div>
<div><Timestamp format="dd日" value="Wed Nov 22 2017 02:06:01 GMT+0800 (CST)"/></div>
</div>
)
}
Expand All @@ -47,7 +48,7 @@ class Demo extends Component {
class Demo extends Component {
render() {
return (
<Timestamp TZC={8} format="yyyy年MM月dd日 hh:mm:ss" value="Wed Nov 22 2017 02:06:01 GMT+0800 (CST)"/>
<Timestamp tzc={8} format="yyyy年MM月dd日 hh:mm:ss" value="Wed Nov 22 2017 02:06:01 GMT+0800 (CST)"/>
)
}
}
Expand All @@ -72,4 +73,4 @@ import Timestamp from 'uiw/lib/timestamp';
|--------- |-------- |--------- |-------- |
| value | 日期值作为ISO8601字符串或Date对象 | String | - |
| format | 格式化时间 | String | - |
| TZC | 服务器时区,解决因时区变更,导致显示服务器时间不准确 time Zone Converter | Number | - |
| tzc | 服务器时区,解决因时区变更,导致显示服务器时间不准确 time Zone Converter | Number | - |
8 changes: 4 additions & 4 deletions src/timestamp/Timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ export default class Timestamp extends Component {
}
}
componentDidMount() {
const { value, format, TZC } = this.props
const { value, format, tzc } = this.props
this.setState({
date: formatDate(timeZoneConverter(value, TZC), format)
date: formatDate(timeZoneConverter(value, tzc), format)
})
}
componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value || nextProps.format !== this.props.format) {
this.setState({
date: formatDate(timeZoneConverter(nextProps.value, nextProps.TZC), nextProps.format)
date: formatDate(timeZoneConverter(nextProps.value, nextProps.tzc), nextProps.format)
})
}
}
Expand All @@ -60,7 +60,7 @@ export default class Timestamp extends Component {

Timestamp.propTypes = {
prefixCls: PropTypes.string,
TZC: PropTypes.number,
tzc: PropTypes.number, // time Zone Converter
value: PropTypes.oneOfType([
PropTypes.string, // ISO-8601 string
PropTypes.object // Date object
Expand Down

0 comments on commit 063c00e

Please sign in to comment.