diff --git a/components/calendar/Constants.js b/components/calendar/Constants.js index fc56dc22db..dbd68b60a5 100644 --- a/components/calendar/Constants.js +++ b/components/calendar/Constants.js @@ -1,3 +1 @@ -export default { - PREFIX_CLS: 'ant-fullcalendar', -}; +export const PREFIX_CLS = 'ant-fullcalendar'; diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx index f083dc4de8..c77e024743 100644 --- a/components/calendar/index.jsx +++ b/components/calendar/index.jsx @@ -1,6 +1,6 @@ import React, {PropTypes, Component} from 'react'; import GregorianCalendar from 'gregorian-calendar'; -import CalendarLocale from 'rc-calendar/lib/locale/zh_CN'; +import zhCn from '../datepicker/locale/zh_CN'; import FullCalendar from 'rc-calendar/lib/FullCalendar'; import {PREFIX_CLS} from './Constants'; import Header from './Header'; @@ -14,15 +14,15 @@ function zerofixed (v) { class Calendar extends Component { constructor(props) { - super(); + super(props); this.state = { value: this.parseDateFromValue(props.value || new Date()), mode: props.mode, }; } parseDateFromValue(value) { - const date = new GregorianCalendar(); - date.setTime(value); + const date = new GregorianCalendar(this.props.locale); + date.setTime(+value); return date; } componentWillReceiveProps(nextProps) { @@ -93,12 +93,13 @@ class Calendar extends Component { fullscreen={fullscreen} type={type} value={value} - locale={locale} + locale={locale.lang} prefixCls={prefixCls} onTypeChange={this.setType.bind(this)} onValueChange={this.setValue.bind(this)}/>