Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

exporte event in .ical #10

Open
jerlemaire opened this issue Jul 19, 2017 · 1 comment
Open

exporte event in .ical #10

jerlemaire opened this issue Jul 19, 2017 · 1 comment

Comments

@jerlemaire
Copy link
Collaborator

No description provided.

@jy95
Copy link

jy95 commented Sep 10, 2018

The main challenge is to find a ical generator that works in your app context ^^
For a personal project I had done recently (a webExtension that export a ical) , only the package "ical-generator" works for me whereas other packages ( like "ics" , "vobject" , .... ) fail .
When you have one, the rest could be done like that :

Get the url of the Blob you want to create :

// icalGenerator is the generator you will use with your events in order to get Ical string
// for example : "//  BEGIN:VCALENDAR .... " 
let blob = new Blob([icalGenerator(events)], {
          type: "text/calendar"
});
const url = URL.createObjectURL(blob);

Invoke the download with Ionic :

import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file';

const fileTransfer: FileTransferObject = this.transfer.create();

fileTransfer.download(url, this.file.dataDirectory + 'generatedCalendar.ical').then((entry) => {
    console.log('download complete: ' + entry.toURL());
  }, (error) => {
    // handle error
  });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants