From 03e59b7a7766a13473d1b18e8b441b4a797a710f Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 26 May 2015 12:03:49 +0800 Subject: [PATCH] default value of datepicker --- components/datepicker/index.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/datepicker/index.jsx b/components/datepicker/index.jsx index 88077a6282..548d400f10 100644 --- a/components/datepicker/index.jsx +++ b/components/datepicker/index.jsx @@ -20,6 +20,13 @@ module.exports = React.createClass({ format: 'yyyy-MM-dd' }; }, + componentDidMount: function () { + if (this.props.value) { + var value = new GregorianCalendar(zhCn); + value.setTime(new Date(this.props.value)); + this.setState({value: value}); + } + }, render: function () { var state = this.state; var formatter = new DateTimeFormat(this.props.format);