williamtroup/Calendar.js

import some events

sargi opened this issue · 13 comments

sargi commented

Hello,
Can I import or add some events from JSON? And see these events still on the website?
Can I disable all buttons on header except prev and next month and months and years?
I tried several options, but do not work.

Thanks for help.

If you look in the functions list, there are 4 functions that will help you add events. You can JSON.Parse you json data and use one of those functions to add them.

I will be adding more support to disable the other buttons on the toolbar, which will be coming in a later version. I will keep you informed!

Dont forget to star and share the project if you like it :)

I've added a new setting that will disable the buttons on the main display. This will be available in v1.3.0 when it becomes available.

Let me know if you need any more assistance.

Version 1.3.0 has just been released. This new release contains new options and functions for disabling the buttons on the title bar and import JSON directly.

Let me know if you have any issues.

sargi commented

amazing, thanks

sargi commented

Hello,
Can you help me with call events from json file? I've tried a few options, but it still doesn't work for me.
sometimes I'm a jerk :-)
I'm still learning

Thanks for help

sargi commented

Is there any way to remove holidays like April 1st and more? Or translate the names of these holidays?

Take a look at the options you can pass to the setOptions() function, this will allow you to set, or clear, the holidays, and change the test for every area to whatever you want.

sargi commented

Thank you. I hope I can do that :-)
And the previous request for help with JSON?

What do you mean by call events from JSON? Do you mean calling an event when you import some JSON?

sargi commented

Sry, I have JSON FILE with events. So can you help me with calling an events using a JSON file?
I am sorry for my English. I don't speak English very well :-D

JSON cannot contain events, it's a notation format for storing data.

I'm not sure entirely what your trying to do, but if you show me an example, I'll point you in the right place.

sargi commented

I'll try.
When I export all events to a JSON file. I have a JSON file with a list of all events. I need advice on how to use this JSON file to import these events from a JSON file into the calendar. I do not want to copy all items directly into the script in html again. Is there any way to import this or it is better to write everything directly into <script> in HTML as you have it in the example calendarjs.html?

This is one of many events from JSON file.
{
from: new Date('2021-08-10T13:24:00'),
to: new Date('2021-08-10T15:24:00'),
title: "FC Jílové - FK Komárov",
description: "Nějaký popis.",
location: "Teams Meeting"
},

You would need to upload the file using a form, read the contents of the file and then call the addEventsFromJson() on the calendar instance.