{"id":15305108,"url":"https://github.com/eddyverbruggen/nativescript-calendar","last_synced_at":"2025-04-13T23:51:14.264Z","repository":{"id":3224868,"uuid":"48413924","full_name":"EddyVerbruggen/nativescript-calendar","owner":"EddyVerbruggen","description":":date: NativeScript plugin to Create, Delete and Find Events in the native Calendar","archived":false,"fork":false,"pushed_at":"2023-01-14T01:06:23.000Z","size":12755,"stargazers_count":46,"open_issues_count":29,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T14:01:50.439Z","etag":null,"topics":["agenda","calendar","event","nativescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EddyVerbruggen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-22T06:11:34.000Z","updated_at":"2024-07-03T08:26:43.000Z","dependencies_parsed_at":"2023-01-14T11:09:51.734Z","dependency_job_id":null,"html_url":"https://github.com/EddyVerbruggen/nativescript-calendar","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-calendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-calendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-calendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-calendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EddyVerbruggen","download_url":"https://codeload.github.com/EddyVerbruggen/nativescript-calendar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530586,"owners_count":21119600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agenda","calendar","event","nativescript"],"created_at":"2024-10-01T07:59:04.787Z","updated_at":"2025-04-13T23:51:14.235Z","avatar_url":"https://github.com/EddyVerbruggen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativeScript Calendar Plugin\n\n[![Build Status][build-status]][build-url]\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][npm-url]\n[![Twitter Follow][twitter-image]][twitter-url]\n\n[build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-calendar.svg?branch=master\n[build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-calendar\n[npm-image]:http://img.shields.io/npm/v/nativescript-calendar.svg\n[npm-url]:https://npmjs.org/package/nativescript-calendar\n[downloads-image]:http://img.shields.io/npm/dm/nativescript-calendar.svg\n[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social\u0026label=Follow%20me\n[twitter-url]:https://twitter.com/eddyverbruggen\n\nThe Calendar plugin allows you to manipulate events in the user's native Calendar. You can find, create and delete events in either the default or a custom calendar.\n\nIf you're looking for an awesome in-app UI for the native calendar, then [check this out](http://docs.telerik.com/devtools/nativescript-ui/Controls/NativeScript/Calendar/overview).\n\n## Installation\nFrom the command prompt go to your app's root folder and execute:\n\n#### NativeScript 7\n\n```\ntns plugin add nativescript-calendar\n```\n\n#### NativeScript 6\n\n```\ntns plugin add nativescript-calendar@2.2.1\n```\n\n## iOS runtime permission reason\nYou probably have seen a permission popup like this before (this plugin will trigger one as well, automatically):\n\n\u003cimg src=\"doc/ios_permission_custom_reason.png\" width=\"316px\" height=\"180px\"/\u003e\n\niOS 10+ requires not only this popup, but also a _reason_. In this case it's  \"Custom message from App_Resources\".\n\nYou can provide your own reason for accessing the calendar by adding something like this to `app/App_Resources/ios/Info.plist`:\n\n```xml\n  \u003ckey\u003eNSCalendarsUsageDescription\u003c/key\u003e\n  \u003cstring\u003eMy reason justifying fooling around with your calendar\u003c/string\u003e\n```\n\n_To not crash your app in case you forgot to provide the reason this plugin adds an empty reason to the `.plist` during build. This value gets overridden by anything you specified yourself. You're welcome._\n\n## TypeScript Usage\nOf course you can use this plugin with TypeScript, just import the plugin and use\nthe functions summed up below like this:\n\n```typescript\nimport * as Calendar from \"nativescript-calendar\";\n\n// example for listCalendars:\nCalendar.listCalendars().then(/* .. */);\n```\n\n## Usage\n\nIf you want a quickstart, [clone our demo app](https://github.com/EddyVerbruggen/nativescript-calendar-demo).\n\n### createEvent\n\n```js\n  var Calendar = require(\"nativescript-calendar\");\n\n  // Only the `title`, `startDate` and `endDate` are mandatory, so this would suffice:\n  var options = {\n    title: 'Get groceries',\n    // Make sure these are valid JavaScript Date objects.\n    // In this case we schedule an Event for now + 1 hour, lasting 1 hour.\n    startDate: new Date(new Date().getTime() + (60*60*1000)),\n    endDate: new Date(new Date().getTime() + (2*60*60*1000))\n  };\n\n  // You can however add lots of properties to enrich the Event:\n  options.location = 'The shop';\n  options.notes = 'This event has reminders';\n\n  // iOS has a separate 'url' field, but on Android the plugin appends this to the 'notes' field.\n  options.url = 'http://my.shoppinglist.com';\n\n  // You can also override the default reminder(s) of the Calendar (in minutes):\n  options.reminders = {\n    first: 30,\n    second: 10\n  };\n\n  // You can make this Event recurring (this one repeats every other day for 10 days):\n  options.recurrence = {\n    frequency: \"daily\", // daily | weekly | monthly | yearly\n    interval: 2, // once every 2 days\n    endDate: new Date(new Date().getTime() + (10*24*60*60*1000)) // 10 days\n  };\n\n  // Want to use a custom calendar for your app? Pass in the 'name'.\n  // If the name doesn't yet exist the plugin will create it for you.\n  options.calendar = {\n    name: \"NativeScript Cal\",\n    // the color, in this case red\n    color: \"#FF0000\",\n    // Can be used on Android to group the calendars. Examples: Your app name, or an emailaddress\n    accountName: \"My App Name\"\n  };\n\n  Calendar.createEvent(options).then(\n      function(createdId) {\n        console.log(\"Created Event with ID: \" + createdId);\n      },\n      function(error) {\n        console.log(\"Error creating an Event: \" + error);\n      }\n  );\n```\n\nIf you want an 'all day event', make sure you set the dates to midnight like this:\n```js\n  var d = new Date();\n  d.setHours(0);\n  d.setMinutes(0);\n  d.setSeconds(0);\n\n  // this will create an 'all day event' for tomorrow\n  var startDate = new Date(d.getTime() + (24*60*60*1000));\n  var endDate = new Date(d.getTime() + (2*24*60*60*1000));\n  // .. now use these properties in the options object\n```\n\n### findEvents\n```js\n  var options = {\n    // when searching, dates are mandatory - the event must be within this interval\n    startDate: new Date(new Date().getTime() - (50*24*60*60*1000)),\n    endDate: new Date(new Date().getTime() + (50*24*60*60*1000))\n  };\n\n  // if you know the Event ID, set it here:\n  options.id = '123456';\n\n  // you can optionally pass in a few other properties, any event containing these will be returned:\n  options.title = 'groceries';\n  options.location = 'foo';\n  options.notes = 'bar'; // iOS only\n\n  Calendar.findEvents(options).then(\n      function(events) {\n        console.log(JSON.stringify(events));\n      },\n      function(error) {\n        console.log(\"Error finding Events: \" + error);\n      }\n  );\n```\n\nThe returned 'events' object is an array of JSON events with these properties:\n```js\nid\ntitle\nlocation\nnotes\nurl\nstartDate\nendDate\nallDay\ncalendar {id, name}\nreminders {minutes}\nrecurrence {frequency, interval, endDate}\nattendees {name, email, url, status, role, type}\n```\n\n### deleteEvents\nUsage is largely the same as findEvents, only the result is a bit different ;)\n\n```js\n  var options = {\n    // when searching, dates are mandatory - the event must be within this interval\n    startDate: new Date(new Date().getTime() - (50*24*60*60*1000)),\n    endDate: new Date(new Date().getTime() + (50*24*60*60*1000))\n  };\n\n  // if you know the Event ID, set it here:\n  options.id = '123456';\n\n  // you can optionally pass in a few other properties, any event containing these will be deleted:\n  options.title = 'groceries'; // events _including_ this string will be included in the selection\n  options.location = 'foo';\n  options.notes = 'bar'; // iOS only\n\n  Calendar.deleteEvents(options).then(\n      function(deletedEventIds) {\n        console.log(JSON.stringify(deletedEventIds));\n      },\n      function(error) {\n        console.log(\"Error deleting Events: \" + error);\n      }\n  )\n```\n\n### listCalendars\n```js\n  Calendar.listCalendars().then(\n      function(calendars) {\n        // a JSON array of Calendar objects is returned, each with an 'id' and 'name'\n        console.log(\"Found these Calendars on the device: \" + JSON.stringify(calendars));\n      },\n      function(error) {\n        console.log(\"Error while listing Calendars: \" + error);\n      }\n  )\n```\n\n### deleteCalendar\n\n##### TypeScript\n```typescript\nimport * as Calendar from \"nativescript-calendar\";\n\nCalendar.deleteCalendar({\n  name: \"My Calendar name\"\n}).then(id =\u003e {\n  // id is null if nothing was deleted\n  console.log(`Deleted Calendar with id ${id}`);\n});\n```\n\n## Breaking changes in 2.0.0\nSee [CHANGELOG.md](CHANGELOG.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-calendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddyverbruggen%2Fnativescript-calendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-calendar/lists"}