@cloudtower/eagle 0.33.18 → 0.33.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ var dayjs = require('dayjs');
13
13
  var React = require('react');
14
14
  var common = require('./common.js');
15
15
  var DateRangePicker_style = require('./DateRangePicker.style.js');
16
+ var utils = require('./utils.js');
16
17
  var getCalendarTitle = require('../common/getCalendarTitle.js');
17
18
 
18
19
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -210,11 +211,10 @@ const Month = (props) => {
210
211
  const time = dayjs__default.default(`${year}-${month2}`, "YYYY-M");
211
212
  const allDateInMonth = time.daysInMonth();
212
213
  const dates = new Array(allDateInMonth).fill(1).map((value, index) => index + 1);
213
- const firstDateOfDay = time.set("date", dates[0]).day();
214
214
  monthAndDate.push({
215
215
  month: month2,
216
216
  dates,
217
- firstDateOfDay: Math.max(firstDateOfDay - 1, 0)
217
+ firstDateOfDay: utils.getFirstDateOfMonth(time)
218
218
  });
219
219
  }
220
220
  setMonth(monthAndDate);
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const getFirstDateOfMonth = (date, weekStartOnMonday = true) => (date.set("date", 1).day() - Number(weekStartOnMonday) + 7) % 7;
4
+
5
+ exports.getFirstDateOfMonth = getFirstDateOfMonth;