Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@os-design/date-picker-utils

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@os-design/date-picker-utils - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

10

dist/cjs/index.js
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -38,7 +37,4 @@ value: true

});
var _defaultFormat = _interopRequireDefault(require("./utils/defaultFormat"));
var _defaultLocale = _interopRequireWildcard(require("./utils/defaultLocale"));
Object.keys(_defaultLocale).forEach(function (key) {

@@ -55,7 +51,4 @@ if (key === "default" || key === "__esModule") return;

});
var _getAccessibilityDateLabel = _interopRequireDefault(require("./utils/getAccessibilityDateLabel"));
var _useDatePickerCalendar = _interopRequireWildcard(require("./utils/useDatePickerCalendar"));
Object.keys(_useDatePickerCalendar).forEach(function (key) {

@@ -72,8 +65,5 @@ if (key === "default" || key === "__esModule") return;

});
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
//# sourceMappingURL=index.js.map

6

dist/cjs/utils/changeMonth.js

@@ -7,10 +7,8 @@ "use strict";

exports["default"] = void 0;
var changeMonth = function changeMonth(_ref, monthDiff) {
var month = _ref.month,
year = _ref.year;
year = _ref.year;
var monthSum = month + monthDiff;
var nextMonth = monthSum % 12;
var nextYear = year + Math.trunc(monthSum / 12);
if (nextMonth < 0) {

@@ -20,3 +18,2 @@ nextMonth += 12;

}
return {

@@ -28,5 +25,4 @@ month: Math.abs(nextMonth),

};
var _default = changeMonth;
exports["default"] = _default;
//# sourceMappingURL=changeMonth.js.map

@@ -7,3 +7,2 @@ "use strict";

exports["default"] = void 0;
var defaultFormat = function defaultFormat(date, locale) {

@@ -15,5 +14,4 @@ var day = date.getDate();

};
var _default = defaultFormat;
exports["default"] = _default;
//# sourceMappingURL=defaultFormat.js.map

@@ -7,3 +7,2 @@ "use strict";

exports["default"] = void 0;
var getAccessibilityDateLabel = function getAccessibilityDateLabel(date, locale) {

@@ -15,5 +14,4 @@ var day = date.getDate();

};
var _default = getAccessibilityDateLabel;
exports["default"] = _default;
//# sourceMappingURL=getAccessibilityDateLabel.js.map

4

dist/cjs/utils/getNumberOfWeeks.js

@@ -7,6 +7,5 @@ "use strict";

exports["default"] = void 0;
var getNumberOfWeeks = function getNumberOfWeeks(_ref, firstDayOfWeek) {
var month = _ref.month,
year = _ref.year;
year = _ref.year;
var firstDayOfMonth = new Date(year, month, 1);

@@ -17,5 +16,4 @@ var lastDayOfMonth = new Date(year, month + 1, 0).getDate();

};
var _default = getNumberOfWeeks;
exports["default"] = _default;
//# sourceMappingURL=getNumberOfWeeks.js.map

@@ -7,9 +7,7 @@ "use strict";

exports["default"] = void 0;
var isSameDay = function isSameDay(date, date2) {
return date.getDate() === date2.getDate() && date.getMonth() === date2.getMonth() && date.getFullYear() === date2.getFullYear();
};
var _default = isSameDay;
exports["default"] = _default;
//# sourceMappingURL=isSameDay.js.map

@@ -7,49 +7,31 @@ "use strict";

exports["default"] = void 0;
var _react = require("react");
var _changeMonth = _interopRequireDefault(require("./changeMonth"));
var _getNumberOfWeeks = _interopRequireDefault(require("./getNumberOfWeeks"));
var _isSameDay = _interopRequireDefault(require("./isSameDay"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var useDatePickerCalendar = function useDatePickerCalendar(_ref) {
var value = _ref.value,
_ref$firstDayOfWeek = _ref.firstDayOfWeek,
firstDayOfWeek = _ref$firstDayOfWeek === void 0 ? 'sunday' : _ref$firstDayOfWeek;
_ref$firstDayOfWeek = _ref.firstDayOfWeek,
firstDayOfWeek = _ref$firstDayOfWeek === void 0 ? 'sunday' : _ref$firstDayOfWeek;
var _useState = (0, _react.useState)(function () {
var date = value === undefined || value === null ? new Date() : new Date(value * 1000);
return {
month: date.getMonth(),
year: date.getFullYear()
};
}),
_useState2 = _slicedToArray(_useState, 2),
selectedMonth = _useState2[0],
setSelectedMonth = _useState2[1];
var date = !value ? new Date() : value;
return {
month: date.getMonth(),
year: date.getFullYear()
};
}),
_useState2 = _slicedToArray(_useState, 2),
selectedMonth = _useState2[0],
setSelectedMonth = _useState2[1];
var updateMonth = (0, _react.useCallback)(function (monthDiff) {

@@ -60,3 +42,3 @@ setSelectedMonth((0, _changeMonth["default"])(selectedMonth, monthDiff));

var month = selectedMonth.month,
year = selectedMonth.year;
year = selectedMonth.year;
var firstDay = new Date(year, month, 1);

@@ -73,3 +55,3 @@ var dayOfWeek = firstDay.getDay();

var month = selectedMonth.month,
year = selectedMonth.year;
year = selectedMonth.year;
var lastDay = new Date(year, month + 1, 0);

@@ -87,3 +69,3 @@ var dayOfWeek = lastDay.getDay();

var month = selectedMonth.month,
year = selectedMonth.year;
year = selectedMonth.year;
var firstDay = new Date(year, month, 1);

@@ -105,3 +87,3 @@ var lastDay = new Date(year, month + 1, 0);

})), _toConsumableArray(daysCurMonth.map(function (date) {
if (value !== undefined && value !== null && (0, _isSameDay["default"])(date, new Date(value * 1000))) {
if (value && (0, _isSameDay["default"])(date, value)) {
return {

@@ -112,3 +94,2 @@ type: 'selectedDay',

}
if ((0, _isSameDay["default"])(date, new Date())) {

@@ -120,3 +101,2 @@ return {

}
return {

@@ -139,5 +119,4 @@ type: 'day',

};
var _default = useDatePickerCalendar;
exports["default"] = _default;
//# sourceMappingURL=useDatePickerCalendar.js.map

@@ -8,3 +8,2 @@ const changeMonth = ({

let nextYear = year + Math.trunc(monthSum / 12);
if (nextMonth < 0) {

@@ -14,3 +13,2 @@ nextMonth += 12;

}
return {

@@ -22,4 +20,3 @@ month: Math.abs(nextMonth),

};
export default changeMonth;
//# sourceMappingURL=changeMonth.js.map

@@ -7,4 +7,3 @@ const defaultFormat = (date, locale) => {

};
export default defaultFormat;
//# sourceMappingURL=defaultFormat.js.map

@@ -7,4 +7,3 @@ const getAccessibilityDateLabel = (date, locale) => {

};
export default getAccessibilityDateLabel;
//# sourceMappingURL=getAccessibilityDateLabel.js.map

@@ -10,4 +10,3 @@ const getNumberOfWeeks = ({

};
export default getNumberOfWeeks;
//# sourceMappingURL=getNumberOfWeeks.js.map
const isSameDay = (date, date2) => date.getDate() === date2.getDate() && date.getMonth() === date2.getMonth() && date.getFullYear() === date2.getFullYear();
export default isSameDay;
//# sourceMappingURL=isSameDay.js.map

@@ -5,3 +5,2 @@ import { useCallback, useMemo, useState } from 'react';

import isSameDay from './isSameDay';
const useDatePickerCalendar = ({

@@ -12,3 +11,3 @@ value,

const [selectedMonth, setSelectedMonth] = useState(() => {
const date = value === undefined || value === null ? new Date() : new Date(value * 1000);
const date = !value ? new Date() : value;
return {

@@ -69,3 +68,3 @@ month: date.getMonth(),

})), ...daysCurMonth.map(date => {
if (value !== undefined && value !== null && isSameDay(date, new Date(value * 1000))) {
if (value && isSameDay(date, value)) {
return {

@@ -76,3 +75,2 @@ type: 'selectedDay',

}
if (isSameDay(date, new Date())) {

@@ -84,3 +82,2 @@ return {

}
return {

@@ -100,4 +97,3 @@ type: 'day',

};
export default useDatePickerCalendar;
//# sourceMappingURL=useDatePickerCalendar.js.map
import { SelectedMonth } from './changeMonth';
export interface UseDatePickerCalendarProps {
value?: number | null;
value?: Date | null;
firstDayOfWeek?: 'sunday' | 'monday';

@@ -5,0 +5,0 @@ }

{
"name": "@os-design/date-picker-utils",
"version": "1.0.9",
"version": "1.0.10",
"license": "UNLICENSED",

@@ -34,3 +34,3 @@ "repository": "git@gitlab.com:os-team/libs/os-design.git",

},
"gitHead": "174987fc6c9d55db201be10abde3a4cf5a790573"
"gitHead": "8081e5c34fd6411d7ca98a699f97fa726e32ce0b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc