@heymantle/litho 0.0.17 → 0.0.18

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.
@@ -305,8 +305,12 @@ function DatePicker() {
305
305
  var startDate = (0, _dates.isValidDate)(_value === null || _value === void 0 ? void 0 : _value.start) ? _value.start : (0, _dayjs.default)().toDate();
306
306
  var endDate = (0, _dates.isValidDate)(_value === null || _value === void 0 ? void 0 : _value.end) ? _value.end : null;
307
307
  var value = (typeof _value === "undefined" ? "undefined" : _type_of(_value)) === "object" && (_value === null || _value === void 0 ? void 0 : _value.start) ? _value.start : _value || null;
308
- var maxDate = _maxDate || disableDatesAfter;
309
- var minDate = _minDate || disableDatesBefore ? (0, _dayjs.default)(disableDatesBefore).subtract(1, "day").toDate() : null;
308
+ var _ref;
309
+ var minSource = (_ref = _minDate !== null && _minDate !== void 0 ? _minDate : disableDatesBefore) !== null && _ref !== void 0 ? _ref : null;
310
+ var _ref1;
311
+ var maxSource = (_ref1 = _maxDate !== null && _maxDate !== void 0 ? _maxDate : disableDatesAfter) !== null && _ref1 !== void 0 ? _ref1 : null;
312
+ var minDate = minSource ? (0, _dayjs.default)(minSource).startOf("day").toDate() : null;
313
+ var maxDate = maxSource ? (0, _dayjs.default)(maxSource).endOf("day").toDate() : null;
310
314
  var maxDateFormatted = maxDate ? (0, _dayjs.default)(maxDate) : null;
311
315
  var minDateFormatted = minDate ? (0, _dayjs.default)(minDate) : null;
312
316
  var dateRange = getDateRange({
@@ -335,10 +339,10 @@ function DatePicker() {
335
339
  var isEndDate = allowRange ? formattedDate === (0, _dayjs.default)(endDate).format(_dates.DAY_FORMAT) : false;
336
340
  var isBetween = allowRange ? dayjsDate.isAfter((0, _dayjs.default)(startDate)) && dayjsDate.isBefore((0, _dayjs.default)(endDate)) : false;
337
341
  var disabled = false;
338
- if (maxDateFormatted && dayjsDate.isAfter(maxDateFormatted)) {
342
+ if (maxDateFormatted && dayjsDate.isAfter(maxDateFormatted, "day")) {
339
343
  disabled = true;
340
344
  }
341
- if (minDateFormatted && dayjsDate.isBefore(minDateFormatted)) {
345
+ if (minDateFormatted && dayjsDate.isBefore(minDateFormatted, "day")) {
342
346
  disabled = true;
343
347
  }
344
348
  var dayClasses = dayStyles({
@@ -290,8 +290,12 @@ function DatePicker() {
290
290
  var startDate = isValidDate(_value === null || _value === void 0 ? void 0 : _value.start) ? _value.start : dayjs().toDate();
291
291
  var endDate = isValidDate(_value === null || _value === void 0 ? void 0 : _value.end) ? _value.end : null;
292
292
  var value = (typeof _value === "undefined" ? "undefined" : _type_of(_value)) === "object" && (_value === null || _value === void 0 ? void 0 : _value.start) ? _value.start : _value || null;
293
- var maxDate = _maxDate || disableDatesAfter;
294
- var minDate = _minDate || disableDatesBefore ? dayjs(disableDatesBefore).subtract(1, "day").toDate() : null;
293
+ var _ref;
294
+ var minSource = (_ref = _minDate !== null && _minDate !== void 0 ? _minDate : disableDatesBefore) !== null && _ref !== void 0 ? _ref : null;
295
+ var _ref1;
296
+ var maxSource = (_ref1 = _maxDate !== null && _maxDate !== void 0 ? _maxDate : disableDatesAfter) !== null && _ref1 !== void 0 ? _ref1 : null;
297
+ var minDate = minSource ? dayjs(minSource).startOf("day").toDate() : null;
298
+ var maxDate = maxSource ? dayjs(maxSource).endOf("day").toDate() : null;
295
299
  var maxDateFormatted = maxDate ? dayjs(maxDate) : null;
296
300
  var minDateFormatted = minDate ? dayjs(minDate) : null;
297
301
  var dateRange = getDateRange({
@@ -320,10 +324,10 @@ function DatePicker() {
320
324
  var isEndDate = allowRange ? formattedDate === dayjs(endDate).format(DAY_FORMAT) : false;
321
325
  var isBetween = allowRange ? dayjsDate.isAfter(dayjs(startDate)) && dayjsDate.isBefore(dayjs(endDate)) : false;
322
326
  var disabled = false;
323
- if (maxDateFormatted && dayjsDate.isAfter(maxDateFormatted)) {
327
+ if (maxDateFormatted && dayjsDate.isAfter(maxDateFormatted, "day")) {
324
328
  disabled = true;
325
329
  }
326
- if (minDateFormatted && dayjsDate.isBefore(minDateFormatted)) {
330
+ if (minDateFormatted && dayjsDate.isBefore(minDateFormatted, "day")) {
327
331
  disabled = true;
328
332
  }
329
333
  var dayClasses = dayStyles({
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../components/DatePicker.js"],"names":[],"mappings":";AAgMA,iFA+UC"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../components/DatePicker.js"],"names":[],"mappings":";AAgMA,iFA8UC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@heymantle/litho",
3
3
  "description": "Litho is a library of components for building Mantle extensions",
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/index.js",
7
7
  "module": "./dist/esm/index.js",