From 55dfcfa04bd8b0080f17434b11e6414da02b85d8 Mon Sep 17 00:00:00 2001 From: Denis Tuzhik Date: Thu, 30 Jun 2016 13:38:39 +0300 Subject: [PATCH 1/3] Use Monday as start of the week by default --- src/components/DateTimePickerDays.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/DateTimePickerDays.js b/src/components/DateTimePickerDays.js index 58b46c0f..f09874e7 100644 --- a/src/components/DateTimePickerDays.js +++ b/src/components/DateTimePickerDays.js @@ -4,7 +4,7 @@ import classnames from "classnames"; import styles from '../css/date-time-picker-days.css'; import CSSModules from 'react-css-modules'; import NextPrevChanger from './next-prev-changer/next-prev-changer.js' - + @CSSModules(styles, { allowMultiple: true }) export default class DateTimePickerDays extends Component { static propTypes = { @@ -35,12 +35,13 @@ export default class DateTimePickerDays extends Component { month = this.props.viewDate.month(); prevMonth = this.props.viewDate.clone().subtract(1, "months"); days = prevMonth.daysInMonth(); - prevMonth.date(days).startOf("week"); + prevMonth.date(days).startOf("isoweek"); nextMonth = moment(prevMonth).clone().add(42, "d"); minDate = this.props.minDate ? this.props.minDate.clone().subtract(1, "days") : this.props.minDate; maxDate = this.props.maxDate ? this.props.maxDate.clone() : this.props.maxDate; html = []; cells = []; + while (prevMonth.isBefore(nextMonth)) { let classes = { day: true @@ -73,12 +74,12 @@ export default class DateTimePickerDays extends Component { } cells.push( - {prevMonth.date()} ); - if (prevMonth.weekday() === moment().endOf("week").weekday()) { + if (prevMonth.weekday() === moment().endOf("isoweek").weekday()) { row = {cells}; html.push(row); cells = []; @@ -100,13 +101,13 @@ export default class DateTimePickerDays extends Component { {moment.months()[this.props.viewDate.month()]} {this.props.viewDate.year()} - Su Mo Tu We Th Fr Sa + Su From e6ebf74998466fe8f95239c7a3f696be711c108e Mon Sep 17 00:00:00 2001 From: Denis Tuzhik Date: Thu, 30 Jun 2016 13:39:06 +0300 Subject: [PATCH 2/3] Update dist files --- dist/react-bootstrap-datetimepicker.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dist/react-bootstrap-datetimepicker.js b/dist/react-bootstrap-datetimepicker.js index 1b637a1d..652d8ab3 100644 --- a/dist/react-bootstrap-datetimepicker.js +++ b/dist/react-bootstrap-datetimepicker.js @@ -7459,11 +7459,6 @@ return /******/ (function(modules) { // webpackBootstrap _react2.default.createElement( "tr", { styleName: "day-of-week" }, - _react2.default.createElement( - "th", - null, - "Su" - ), _react2.default.createElement( "th", null, @@ -7493,6 +7488,11 @@ return /******/ (function(modules) { // webpackBootstrap "th", null, "Sa" + ), + _react2.default.createElement( + "th", + null, + "Su" ) ) ), @@ -7540,12 +7540,13 @@ return /******/ (function(modules) { // webpackBootstrap month = _this2.props.viewDate.month(); prevMonth = _this2.props.viewDate.clone().subtract(1, "months"); days = prevMonth.daysInMonth(); - prevMonth.date(days).startOf("week"); + prevMonth.date(days).startOf("isoweek"); nextMonth = (0, _moment2.default)(prevMonth).clone().add(42, "d"); minDate = _this2.props.minDate ? _this2.props.minDate.clone().subtract(1, "days") : _this2.props.minDate; maxDate = _this2.props.maxDate ? _this2.props.maxDate.clone() : _this2.props.maxDate; html = []; cells = []; + while (prevMonth.isBefore(nextMonth)) { var classes = { day: true @@ -7585,7 +7586,7 @@ return /******/ (function(modules) { // webpackBootstrap onClick: _this2.handleDateClick.bind(_this2, !!classes.disabled) }, prevMonth.date() )); - if (prevMonth.weekday() === (0, _moment2.default)().endOf("week").weekday()) { + if (prevMonth.weekday() === (0, _moment2.default)().endOf("isoweek").weekday()) { row = _react2.default.createElement( "tr", { key: prevMonth.month() + "-" + prevMonth.date() }, From 346da1782d8967e5935c53680eca97064fab7ff2 Mon Sep 17 00:00:00 2001 From: Denis Tuzhik Date: Thu, 30 Jun 2016 13:40:04 +0300 Subject: [PATCH 3/3] Bump npm version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b5f6627..761333de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@testlio/react-bootstrap-datetimepicker", - "version": "0.3.0", + "version": "0.4.0", "description": "A bootstrap datetime picker component for React.js", "homepage": "http://dev.quri.com/react-bootstrap-datetimepicker/", "repository": {