Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
chore: change UX of calendar header, close: ant-design/ant-design#6377
Browse files Browse the repository at this point in the history
  • Loading branch information
benjycui committed Jun 28, 2017
1 parent 62cdaa5 commit cc88e30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions examples/antd-range-calendar.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
/* eslint react/no-multi-comp:0, no-console:0 */

import 'rc-calendar/assets/index.less';
import RangeCalendar from 'rc-calendar/src/RangeCalendar';
import React from 'react';
import ReactDOM from 'react-dom';
import Picker from 'rc-calendar/src/Picker';

import 'rc-time-picker/assets/index.css';

import RangeCalendar from 'rc-calendar/src/RangeCalendar';
import zhCN from 'rc-calendar/src/locale/zh_CN';
import enUS from 'rc-calendar/src/locale/en_US';
import 'rc-time-picker/assets/index.css';
import TimePickerPanel from 'rc-time-picker/lib/Panel';
import 'rc-calendar/assets/index.less';
import 'rc-time-picker/assets/index.css';

import moment from 'moment';
import 'moment/locale/zh-cn';
import 'moment/locale/en-gb';

const formatStr = 'YYYY-MM-DD HH:mm:ss';
const cn = location.search.indexOf('cn') !== -1;

if (cn) {
moment.locale('zh-cn');
} else {
moment.locale('en-gb');
}

const now = moment();
if (cn) {
now.locale('zh-cn').utcOffset(8);
now.utcOffset(8);
} else {
now.locale('en-gb').utcOffset(0);
now.utcOffset(0);
}

const defaultCalendarValue = now.clone();
Expand Down Expand Up @@ -94,6 +96,7 @@ function disabledTime(time, type) {
};
}

const formatStr = 'YYYY-MM-DD HH:mm:ss';
function format(v) {
return v ? v.format(formatStr) : '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/calendar/CalendarHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const CalendarHeader = createReactClass({
onClick={showTimePicker ? null : this.showMonthPanel}
title={locale.monthSelect}
>
{localeData.months(value)}
{localeData.monthsShort(value)}
</a>);
let day;
if (showTimePicker) {
Expand Down

0 comments on commit cc88e30

Please sign in to comment.