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

@event-calendar/common

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-calendar/common - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0-beta.1

121

index.js
import { is_function } from 'svelte/internal';
import { writable, derived, get } from 'svelte/store';
function setContent(node, content) {
let actions = {
update(content) {
while (node.firstChild) {
node.removeChild(node.lastChild);
}
if (content.domNodes) {
for (let child of content.domNodes) {
node.appendChild(child);
}
} else if (content.html) {
node.innerHTML = content.html;
}
}
};
actions.update(content);
return actions;
}
const DAY_IN_SECONDS = 86400;

@@ -45,16 +65,34 @@

function addDuration(date, duration, multiplier) {
return _addSubDuration(date, duration, multiplier === undefined ? +1 : multiplier);
function addDuration(date, duration, x) {
if (x === undefined) {
x = 1;
}
date.setUTCFullYear(date.getUTCFullYear() + x * duration.years);
let month = date.getUTCMonth() + x * duration.months;
date.setUTCMonth(month);
month %= 12;
if (month < 0) {
month += 12;
}
while (date.getUTCMonth() !== month) {
subtractDay(date);
}
date.setUTCDate(date.getUTCDate() + x * duration.days);
date.setUTCSeconds(date.getUTCSeconds() + x * duration.seconds);
return date;
}
function subtractDuration(date, duration, multiplier) {
return _addSubDuration(date, duration, multiplier === undefined ? -1 : multiplier);
function subtractDuration(date, duration, x) {
return addDuration(date, duration, x === undefined ? -1 : -x);
}
function addDay(date) {
return _addSubDays(date, +1);
function addDay(date, x) {
date.setUTCDate(date.getUTCDate() + (x === undefined ? 1 : x));
return date;
}
function subtractDay(date) {
return _addSubDays(date, -1);
function subtractDay(date, x) {
return addDay(date, x === undefined ? -1 : -x);
}

@@ -163,25 +201,2 @@

function _addSubDuration(date, duration, x) {
date.setUTCFullYear(date.getUTCFullYear() + x * duration.years);
let month = date.getUTCMonth() + x * duration.months;
date.setUTCMonth(month);
month %= 12;
if (month < 0) {
month += 12;
}
while (date.getUTCMonth() !== month) {
subtractDay(date);
}
date.setUTCDate(date.getUTCDate() + x * duration.days);
date.setUTCSeconds(date.getUTCSeconds() + x * duration.seconds);
return date;
}
function _addSubDays(date, x) {
date.setUTCDate(date.getUTCDate() + x);
return date;
}
function _commonChunks(str1, substr1, str2, substr2) {

@@ -236,20 +251,4 @@ let i = 0;

function action(node, content) {
let actions = {
update(content) {
while (node.firstChild) {
node.removeChild(node.lastChild);
}
if (content.domNodes) {
for (let child of content.domNodes) {
node.appendChild(child);
}
} else if (content.html) {
node.innerHTML = content.html;
}
}
};
actions.update(content);
return actions;
function rect(el) {
return el.getBoundingClientRect();
}

@@ -279,2 +278,4 @@

const display = ['background'];
let eventId = 1;

@@ -290,3 +291,3 @@ function createEvents(input) {

title: event.title || '',
display: event.display || 'auto',
display: display.includes(event.display) ? event.display : 'auto',
extendedProps: event.extendedProps || {},

@@ -359,5 +360,13 @@ backgroundColor: event.backgroundColor || event.color

function toEventWithLocalDates(event) {
return _cloneEvent(event, toLocalDate);
}
function cloneEvent(event) {
return _cloneEvent(event, cloneDate);
}
function _cloneEvent(event, dateFn) {
event = assign({}, event);
event.start = toLocalDate(event.start);
event.end = toLocalDate(event.end);
event.start = dateFn(event.start);
event.end = dateFn(event.end);

@@ -367,6 +376,6 @@ return event;

function writable2(value, mutator, start) {
function writable2(value, parser, start) {
return {
...writable(mutator ? mutator(value) : value, start),
mutate: mutator
...writable(parser ? parser(value) : value, start),
parse: parser
};

@@ -419,2 +428,2 @@ }

export { DAY_IN_SECONDS, action, addDay, addDuration, assign, cloneDate, createDate, createDuration, createEventChunk, createEventContent, createEventSources, createEvents, createView, datesEqual, derived2, formatRange, hasYScroll, intl, intlRange, nextClosestDay, prevClosestDay, setMidnight, sortEventChunks, subtractDay, subtractDuration, toEventWithLocalDates, toISOString, toLocalDate, toViewWithLocalDates, writable2 };
export { DAY_IN_SECONDS, addDay, addDuration, assign, cloneDate, cloneEvent, createDate, createDuration, createEventChunk, createEventContent, createEventSources, createEvents, createView, datesEqual, derived2, formatRange, hasYScroll, intl, intlRange, nextClosestDay, prevClosestDay, rect, setContent, setMidnight, sortEventChunks, subtractDay, subtractDuration, toEventWithLocalDates, toISOString, toLocalDate, toViewWithLocalDates, writable2 };
{
"name": "@event-calendar/common",
"version": "0.0.1",
"title": "EventCalendar Common Package",
"version": "0.1.0-beta.1",
"title": "Event Calendar Common package",
"description": "Full-sized event calendar with resource view",

@@ -6,0 +6,0 @@ "keywords": ["calendar", "event", "resource", "full-sized"],

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