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

calendar-link

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calendar-link - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

70

dist/index.js

@@ -7,26 +7,37 @@ "use strict";

const dayjs_1 = __importDefault(require("dayjs"));
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
const querystring_1 = require("querystring");
dayjs_1.default.extend(utc_1.default);
exports.eventify = (event) => {
event.start = dayjs_1.default(event.start).toDate();
if (event.duration && event.duration.length && !event.end) {
const duration = Number(event.duration[0]);
const unit = event.duration[1];
event.end = dayjs_1.default(event.start)
.add(duration, unit)
.toDate();
if (event.end == null) {
if (event.duration && event.duration.length) {
const duration = Number(event.duration[0]);
const unit = event.duration[1];
event.end = dayjs_1.default(event.start)
.add(duration, unit)
.toDate();
}
if (event.allDay) {
event.end = dayjs_1.default(event.start)
.add(1, "day")
.toDate();
}
}
return event;
};
const formats = {
dateTime: "YYYYMMDD[T]HHmmss",
dateTimeUTC: "YYYYMMDD[T]HHmmss[Z]",
allDay: "YYYYMMDD"
};
exports.google = (event) => {
event = exports.eventify(event);
const startDate = dayjs_1.default(event.start)
.toISOString()
.replace(/-/g, "")
.replace(/:/g, "")
.replace(/\./g, "");
const endDate = dayjs_1.default(event.end)
.toISOString()
.replace(/-/g, "")
.replace(/:/g, "")
.replace(/\./g, "");
const format = event.allDay ? formats.allDay : formats.dateTimeUTC;
const start = dayjs_1.default(event.start)
.utc()
.format(format);
const end = dayjs_1.default(event.end)
.utc()
.format(format);
const details = {

@@ -38,6 +49,3 @@ action: "TEMPLATE",

trp: event.busy,
dates: startDate.substring(0, startDate.length - 4) +
"Z/" +
endDate.substring(0, endDate.length - 4) +
"Z"
dates: start + "/" + end
};

@@ -51,7 +59,14 @@ if (event.guests && event.guests.length) {

event = exports.eventify(event);
const format = event.allDay ? formats.allDay : formats.dateTime;
const start = dayjs_1.default(event.start)
.utc()
.format(format);
const end = dayjs_1.default(event.end)
.utc()
.format(format);
const details = {
path: "/calendar/action/compose",
rru: "addevent",
startdt: dayjs_1.default(event.start).format("YYYYMMDD[T]HHmmss"),
enddt: dayjs_1.default(event.end).format("YYYYMMDD[T]HHmmss"),
startdt: start,
enddt: end,
subject: event.title,

@@ -65,7 +80,14 @@ body: event.description,

event = exports.eventify(event);
const format = event.allDay ? formats.allDay : formats.dateTimeUTC;
const start = dayjs_1.default(event.start)
.utc()
.format(format);
const end = dayjs_1.default(event.end)
.utc()
.format(format);
const details = {
v: 60,
title: event.title,
st: dayjs_1.default(event.start).format("YYYYMMDD[T]HHmmss"),
et: dayjs_1.default(event.end).format("YYYYMMDD[T]HHmmss"),
st: start,
et: end,
desc: event.description,

@@ -72,0 +94,0 @@ in_loc: event.location

@@ -7,2 +7,3 @@ import dayjs from "dayjs";

duration?: [number, dayjs.UnitType];
allDay?: boolean;
description?: string;

@@ -9,0 +10,0 @@ location?: string;

{
"name": "calendar-link",
"version": "1.0.1",
"version": "1.1.0",
"main": "dist/index.js",

@@ -23,10 +23,10 @@ "files": [

"devDependencies": {
"@types/jest": "^24.0.11",
"@types/jest": "^24.0.13",
"concurrently": "^4.1.0",
"coveralls": "^3.0.3",
"jest": "^24.5.0",
"onchange": "^5.2.0",
"prettier": "^1.16.4",
"ts-jest": "^24.0.0",
"typescript": "^3.3.4000"
"onchange": "^6.0.0",
"prettier": "^1.17.1",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
},

@@ -50,5 +50,5 @@ "jest": {

"dependencies": {
"dayjs": "^1.8.11",
"query-string": "^6.4.2"
"dayjs": "^1.8.14",
"query-string": "^6.5.0"
}
}

@@ -7,3 +7,5 @@ # Calendar Link

![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/AnandChowdhary/calendar-link.svg)
[![Made in Enschede](https://img.shields.io/badge/made%20in-Enschede-brightgreen.svg)](https://cityofenschede.com/)
![NPM type definitions](https://img.shields.io/npm/types/calendar-link.svg)
[![NPM](https://img.shields.io/npm/v/calendar-link.svg)](https://www.npmjs.com/package/calendar-link)
[![All contributors](https://img.shields.io/badge/all_contributors-2-orange.svg)](#contributors)

@@ -41,2 +43,3 @@ JavaScript library to generate an event link for Google Calendar, Yahoo! Calendar, Microsoft Outlook, etc.

| `duration` 🤙 | Event duration | Array with value (Number) and unit (String) |
| `allDay` 🤙 | All day event | Boolean |
| `description` 👌 | Information about the event | String |

@@ -47,2 +50,4 @@ | `location` 👌 | Event location in words | String |

The `duration` field is ignored if `allDay` is used.
#### Support key

@@ -60,1 +65,13 @@

MIT © [Anand Chowdhary](https://anandchowdhary.com/?utm_source=github&utm_medium=calendar-link&utm_campaign=readme)
## Contributors
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://anandchowdhary.com/?utm_source=github&utm_campaign=about-link"><img src="https://avatars3.githubusercontent.com/u/2841780?v=4" width="100px;" alt="Anand Chowdhary"/><br /><sub><b>Anand Chowdhary</b></sub></a><br /><a href="https://github.com/AnandChowdhary/calendar-link/commits?author=AnandChowdhary" title="Code">💻</a> <a href="https://github.com/AnandChowdhary/calendar-link/commits?author=AnandChowdhary" title="Documentation">📖</a></td><td align="center"><a href="https://keybase.io/lachenmayer"><img src="https://avatars1.githubusercontent.com/u/38614?v=4" width="100px;" alt="Harry Lachenmayer"/><br /><sub><b>Harry Lachenmayer</b></sub></a><br /><a href="https://github.com/AnandChowdhary/calendar-link/commits?author=lachenmayer" title="Code">💻</a> <a href="https://github.com/AnandChowdhary/calendar-link/commits?author=lachenmayer" title="Documentation">📖</a></td><td align="center"><a href="http://AlexImbrea.com"><img src="https://avatars2.githubusercontent.com/u/4534299?v=4" width="100px;" alt="Alexandru-Ionut Imbrea"/><br /><sub><b>Alexandru-Ionut Imbrea</b></sub></a><br /><a href="https://github.com/AnandChowdhary/calendar-link/commits?author=AlexImb" title="Code">💻</a></td></tr></table>
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

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