calendar-link
Advanced tools
Comparing version 1.2.5 to 1.3.0
@@ -5,4 +5,5 @@ import { CalendarEvent, NormalizedCalendarEvent } from "./interfaces"; | ||
export declare const outlook: (calendarEvent: CalendarEvent) => string; | ||
export declare const office365: (calendarEvent: CalendarEvent) => string; | ||
export declare const yahoo: (calendarEvent: CalendarEvent) => string; | ||
export declare const ics: (calendarEvent: CalendarEvent) => string; | ||
export { CalendarEvent }; |
@@ -17,2 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ics = exports.yahoo = exports.office365 = exports.outlook = exports.google = exports.eventify = void 0; | ||
const dayjs_1 = __importDefault(require("dayjs")); | ||
@@ -79,2 +80,16 @@ const utc_1 = __importDefault(require("dayjs/plugin/utc")); | ||
}; | ||
exports.office365 = (calendarEvent) => { | ||
const event = exports.eventify(calendarEvent); | ||
const { start, end } = formatTimes(event, "dateTime"); | ||
const details = { | ||
path: "/calendar/action/compose", | ||
rru: "addevent", | ||
startdt: start, | ||
enddt: end, | ||
subject: event.title, | ||
body: event.description, | ||
location: event.location, | ||
}; | ||
return `https://outlook.office.com/calendar/0/deeplink/compose?${query_string_1.stringify(details)}`; | ||
}; | ||
exports.yahoo = (calendarEvent) => { | ||
@@ -96,4 +111,11 @@ const event = exports.eventify(calendarEvent); | ||
const formattedDescription = (event.description || "") | ||
.replace(/,/gm, "\,") | ||
.replace(/;/gm, "\;") | ||
.replace(/\n/gm, "\\n") | ||
.replace(/(\\n)[\s\t]+/gm, "\\n"); | ||
const formattedLocation = (event.location || "") | ||
.replace(/,/gm, "\,") | ||
.replace(/;/gm, "\;") | ||
.replace(/\n/gm, "\\n") | ||
.replace(/(\\n)[\s\t]+/gm, "\\n"); | ||
const { start, end } = formatTimes(event, "dateTimeUTC"); | ||
@@ -135,3 +157,3 @@ const calendarChunks = [ | ||
key: "LOCATION", | ||
value: event.location, | ||
value: formattedLocation, | ||
}, | ||
@@ -138,0 +160,0 @@ { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TimeFormats = void 0; | ||
exports.TimeFormats = { | ||
@@ -4,0 +5,0 @@ dateTime: "YYYYMMDD[T]HHmmss", |
{ | ||
"name": "calendar-link", | ||
"version": "1.2.5", | ||
"version": "1.3.0", | ||
"main": "dist/index.js", | ||
@@ -23,10 +23,10 @@ "files": [ | ||
"devDependencies": { | ||
"@types/jest": "^25.2.1", | ||
"concurrently": "^5.1.0", | ||
"coveralls": "^3.0.11", | ||
"@types/jest": "^25.2.3", | ||
"concurrently": "^5.2.0", | ||
"coveralls": "^3.1.0", | ||
"jest": "^24.5.0", | ||
"onchange": "^6.1.0", | ||
"prettier": "^2.0.4", | ||
"onchange": "^7.0.2", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^24.3.0", | ||
"typescript": "^3.8.3" | ||
"typescript": "^3.9.3" | ||
}, | ||
@@ -50,5 +50,5 @@ "jest": { | ||
"dependencies": { | ||
"dayjs": "^1.8.24", | ||
"dayjs": "^1.8.28", | ||
"query-string": "^6.12.1" | ||
} | ||
} |
@@ -19,3 +19,3 @@ # Calendar Link | ||
```js | ||
import { google, outlook, yahoo, ics } from "calendar-link"; | ||
import { google, outlook, office365, yahoo, ics } from "calendar-link"; | ||
@@ -33,4 +33,5 @@ // Set event as an object | ||
outlook(event); // https://outlook.live.com/owa/... | ||
office365(event); // https://outlook.office.com/owa/... | ||
yahoo(event); // https://calendar.yahoo.com/?v=60&title=... | ||
ics(event); // standard ICS calendar base on https://icalendar.org/ | ||
ics(event); // standard ICS file based on https://icalendar.org | ||
``` | ||
@@ -40,28 +41,21 @@ | ||
| Property | Description | Allowed values | | ||
| ---------------- | --------------------------- | ------------------------------------------- | | ||
| `title` 👍 | Event title | String | | ||
| `start` 👍 | Start time | JS Date / ISO 8601 string / Unix Timestamp | | ||
| `end` 🤙 | End time | JS Date / ISO 8601 string / Unix Timestamp | | ||
| `duration` 🤙 | Event duration | Array with value (Number) and unit (String) | | ||
| `allDay` 🤙 | All day event | Boolean | | ||
| `description` 👌 | Information about the event | String | | ||
| `location` 👌 | Event location in words | String | | ||
| `busy` 👌 | Mark on calendar as busy? | Boolean | | ||
| `guests` 🤞 | Emails of other guests | Array of emails (String) | | ||
| `url` 🤞 | Calendar document URL | String | | ||
| Property | Description | Allowed values | | ||
| ------------------ | --------------------------- | ------------------------------------------- | | ||
| `title` (required) | Event title | String | | ||
| `start` (required) | Start time | JS Date / ISO 8601 string / Unix Timestamp | | ||
| `end` | End time | JS Date / ISO 8601 string / Unix Timestamp | | ||
| `duration` | Event duration | Array with value (Number) and unit (String) | | ||
| `allDay` | All day event | Boolean | | ||
| `description` | Information about the event | String | | ||
| `location` | Event location in words | String | | ||
| `busy` | Mark on calendar as busy? | Boolean | | ||
| `guests` | Emails of other guests | Array of emails (String) | | ||
| `url` | Calendar document URL | String | | ||
The `duration` field is ignored if `allDay` is used. | ||
Any one of the fields `end`, `duration`, or `allDay` is required. | ||
The `url` field defaults to `document.URL` if a document global exists. | ||
The `url` field defaults to `document.URL` if a global `document` object exists. For server-side rendering, you should supply the `url` manually. | ||
#### Support key | ||
Not all calendars support the `guests` and `url` fields. | ||
| Emoji | Meaning | | ||
| ----- | -------------------------- | | ||
| 👍 | Required | | ||
| 🤙 | Any one is required | | ||
| 👌 | Supported but not required | | ||
| 🤞 | Not all calendars support | | ||
## License | ||
@@ -90,2 +84,5 @@ | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://rhellenes.me"><img src="https://avatars0.githubusercontent.com/u/16990441?v=4" width="100px;" alt=""/><br /><sub><b>René Hellenes</b></sub></a><br /><a href="https://github.com/AnandChowdhary/calendar-link/commits?author=RHellenes" title="Code">💻</a></td> | ||
</tr> | ||
</table> | ||
@@ -92,0 +89,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21891
243
93
Updateddayjs@^1.8.28