Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
Can I add Calendar Event with Javascript?

I want let user input their Date, Time, SUMMARY... etc,
and create a .ics file, then put it into default calendar app to create event,
but it only working on Safari,
when I do this on Chrome, it will download .ics file.

Is possible make it work on both iOS and android?

Here is my code:

function convertDate(date, time) {
            let dateStr = date.replaceAll('/', '');
            let timeStr = time.replaceAll(':', '');
            console.log(dateStr + 'T' + timeStr + '00');
            return dateStr + 'T' + timeStr + '00';
        }

        function addEvent() {
            let startDate = '2021/09/07';
            let startTime = '14:30';
            let endDate = '2021/09/07';
            let endTime = '23:00'

            var icsMSG =
                "BEGIN:VCALENDAR\n" +
                "METHOD:PUBLISH\n" +
                "PRODID:-//VMFIVE//EN\n" +
                "VERSION:2.0\n" +
                "BEGIN:VEVENT\n" +
                "DTSTART:" + convertDate(startDate, startTime) + "\n" +
                "DTEND:" + convertDate(endDate, endTime) + "\n" +
                "SUMMARY:" + 'TEST EVENT' + "\n" +
                "DESCRIPTION:" + 'TEST DESCRIPTION' + "\n" +
                "END:VEVENT\n" +
                "END:VCALENDAR";

            window.open("data:text/calendar;charset=utf8," + escape(icsMSG));
        }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!