vanilla-calendar-picker
Advanced tools
Comparing version 2.10.3 to 2.11.0
{ | ||
"name": "vanilla-calendar-picker", | ||
"version": "2.10.3", | ||
"version": "2.11.0", | ||
"description": "Vanilla Calendar is a versatile JavaScript date and time picker with TypeScript support, making it compatible with any JavaScript framework or library. It is designed to be lightweight, simple to use, and feature-rich without relying on external dependencies.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/ghiscoding/vanilla-calendar-picker", |
@@ -6,2 +6,13 @@ # VanillaCalendar - A Lightweight, Feature-Rich JavaScript Date and Time Picker | ||
### Changes vs Original project | ||
- add new `jumpToSelectedDate` to automatically jump the calendar to the selected date. | ||
- add new `toggleSelected` to prevent date from being unselected (clicking twice). | ||
- add new `auto` option to `positionToInput` to automatically position picker with available space. | ||
- add new `sanitizer` callback option for CSP compliance. | ||
- allow passing `today` as min/max date. | ||
- allow supplying `Date` and/or epoch timestamp (`number`) in addition to ISO date strings. | ||
- add new `changeSetting()` function to be able to change a single setting | ||
--- | ||
[](https://vanilla-calendar.pro/) | ||
@@ -55,10 +66,2 @@ | ||
### Changes vs Original project | ||
- add new `jumpToSelectedDate` to automatically jump the calendar to the selected date | ||
- add new `toggleSelected` to allow removing day selection | ||
- add new `auto` option to `positionToInput` | ||
- add new `sanitizer` callback option | ||
- allow passing `today` as min/max date range | ||
- in addition to ISO date strings, also allow supplying `Date` and/or epoch timestamp as a `number` | ||
### Usage | ||
@@ -65,0 +68,0 @@ |
/*! name: vanilla-calendar-picker | url: https://github.com/uvarov-frontend/vanilla-calendar-picker */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendarUtilities={})}(this,(function(e){"use strict";const t=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,n=e=>new Date(`${e}T00:00:00`);e.getDate=e=>n(e),e.getDateString=e=>t(e),e.parseDates=e=>(e=>e.reduce(((e,a)=>{if(a instanceof Date||"number"==typeof a){const t=a instanceof Date?a:new Date(a);e.push(t.toISOString().substring(0,10))}else a.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(a):a.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((a,i,o)=>{const r=n(i),d=n(o),s=new Date(r.getTime());for(;s<=d;s.setDate(s.getDate()+1))e.push(t(s));return a}));return e}),[]))(e),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); | ||
(function(global, factory) { | ||
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.VanillaCalendarUtilities = {})); | ||
})(this, function(exports2) { | ||
"use strict"; | ||
const getDateString$1 = (date) => { | ||
const year = date.getFullYear(); | ||
const month = String(date.getMonth() + 1).padStart(2, "0"); | ||
const day = String(date.getDate()).padStart(2, "0"); | ||
return `${year}-${month}-${day}`; | ||
}; | ||
const getDate$1 = (date) => /* @__PURE__ */ new Date(`${date}T00:00:00`); | ||
const parseDates$1 = (dates) => dates.reduce((accumulator, date) => { | ||
if (date instanceof Date || typeof date === "number") { | ||
const d = date instanceof Date ? date : new Date(date); | ||
accumulator.push(d.toISOString().substring(0, 10)); | ||
} else if (date.match(/^(\d{4}-\d{2}-\d{2})$/g)) { | ||
accumulator.push(date); | ||
} else { | ||
date.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g, (_, startDateStr, endDateStr) => { | ||
const startDate = getDate$1(startDateStr); | ||
const endDate = getDate$1(endDateStr); | ||
const currentDate = new Date(startDate.getTime()); | ||
for (currentDate; currentDate <= endDate; currentDate.setDate(currentDate.getDate() + 1)) { | ||
accumulator.push(getDateString$1(currentDate)); | ||
} | ||
return _; | ||
}); | ||
} | ||
return accumulator; | ||
}, []); | ||
const parseDates = (dates) => parseDates$1(dates); | ||
const getDateString = (date) => getDateString$1(date); | ||
const getDate = (date) => getDate$1(date); | ||
exports2.getDate = getDate; | ||
exports2.getDateString = getDateString; | ||
exports2.parseDates = parseDates; | ||
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" }); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
411733
5236
187
1