diff --git a/build/MonthView/Day.js b/build/MonthView/Day.js index 35cf4f71..233d8650 100644 --- a/build/MonthView/Day.js +++ b/build/MonthView/Day.js @@ -22,7 +22,7 @@ var className = 'react-calendar__month-view__days__day'; var Day = function Day(_ref) { var active = _ref.active, - calendarType = _ref.calendarType, + currentMonthIndex = _ref.currentMonthIndex, date = _ref.date, maxDate = _ref.maxDate, minDate = _ref.minDate, @@ -30,15 +30,12 @@ var Day = function Day(_ref) { return _react2.default.createElement( 'button', { - className: [className, 'react-calendar__tile', active ? 'react-calendar__tile--active' : '', (0, _dates.isWeekend)(date) ? className + '--weekend' : ''].join(' '), + className: [className, 'react-calendar__tile', active ? 'react-calendar__tile--active' : '', (0, _dates.isWeekend)(date) ? className + '--weekend' : '', date.getMonth() !== currentMonthIndex ? className + '--neighboringMonth' : ''].join(' '), disabled: minDate && (0, _dates.getBeginOfDay)(minDate) > date || maxDate && (0, _dates.getEndOfDay)(maxDate) < date, key: date, onClick: onChange && function () { return onChange(date); - }, - style: (0, _dates.getDay)(date) === 1 ? { - gridColumnStart: (0, _dates.getDayOfWeek)(date, calendarType) + 1 - } : null + } }, _react2.default.createElement( 'time', @@ -51,6 +48,7 @@ var Day = function Day(_ref) { Day.propTypes = { active: _propTypes2.default.bool.isRequired, calendarType: _propTypes3.isCalendarType, + currentMonthIndex: _propTypes2.default.number.isRequired, date: _propTypes2.default.instanceOf(Date).isRequired, maxDate: _propTypes3.isMaxDate, minDate: _propTypes3.isMinDate, diff --git a/build/MonthView/Days.js b/build/MonthView/Days.js index 691b859d..613e3275 100644 --- a/build/MonthView/Days.js +++ b/build/MonthView/Days.js @@ -42,20 +42,19 @@ var Days = function (_Component) { _inherits(Days, _Component); function Days() { - var _ref; - - var _temp, _this, _ret; - _classCallCheck(this, Days); - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Days.__proto__ || Object.getPrototypeOf(Days)).call.apply(_ref, [this].concat(args))), _this), _this.start = 1, _temp), _possibleConstructorReturn(_this, _ret); + return _possibleConstructorReturn(this, (Days.__proto__ || Object.getPrototypeOf(Days)).apply(this, arguments)); } _createClass(Days, [{ + key: 'getDayOfWeek', + value: function getDayOfWeek(date) { + var calendarType = this.props.calendarType; + + return (0, _dates.getDayOfWeek)(date, calendarType); + } + }, { key: 'render', value: function render() { var start = this.start, @@ -63,7 +62,6 @@ var Days = function (_Component) { year = this.year, monthIndex = this.monthIndex; var _props = this.props, - calendarType = _props.calendarType, maxDate = _props.maxDate, minDate = _props.minDate, onChange = _props.onChange, @@ -76,7 +74,7 @@ var Days = function (_Component) { var date = new Date(year, monthIndex, day); days.push(_react2.default.createElement(_Day2.default, _extends({}, (0, _utils.getTileActivityFlags)(value, valueType, date, 'day'), { - calendarType: calendarType, + currentMonthIndex: monthIndex, date: date, maxDate: maxDate, minDate: minDate, @@ -95,12 +93,23 @@ var Days = function (_Component) { days ); } + }, { + key: 'start', + get: function get() { + var activeStartDate = this.props.activeStartDate; + + return -this.getDayOfWeek(activeStartDate) + 1; + } }, { key: 'end', get: function get() { var activeStartDate = this.props.activeStartDate; + var year = this.year, + monthIndex = this.monthIndex; - return (0, _dates.getDaysInMonth)(activeStartDate); + var daysInMonth = (0, _dates.getDaysInMonth)(activeStartDate); + var activeEndDate = new Date(year, monthIndex, daysInMonth); + return (0, _dates.getDaysInMonth)(activeStartDate) + (7 - this.getDayOfWeek(activeEndDate) - 1); } }, { key: 'year',