Searching through various calendar plugins , I found one called jsCalendar by GramThanos .
Among its demos, there is a view called Date Events , which seems perfect for what I need: Greeting people who are having a birthday according to the day.
But as much as I search its official documentation , I don't see how to add one or more events to a given day.
With JS, predefined events are added with the function onclick
, displayed in an alert and temporarily inserted:
// Add events
calendar.onDateClick(function(event, date){
// Update calendar date
calendar.set(date);
// Show events
showEvents(date);
});
elements.addButton.addEventListener("click", function(){
// Get event name
var names = ["John", "Bob", "Anna", "George", "Harry", "Jack", "Alexander"];
var name = prompt(
"Event info",
names[Math. floor(Math.random() * names.length)] + "'s birthday."
);
Can I add events manually in this plugin , or is it just visual?
Some time ago I used fullcalendar.js and I could do it by importing my Google Calendar events automatically, but if I have to do it manually I have no problem.
PS: In the Date Events example you can edit the events, I do NOT want them to be editable on the user side.
I accept any suggestion or if there are other alternatives, they are welcome.
Thanks for your time!
Just hit play and look at the comments in the code, it's what you're looking for. Check February 12 and February 21.
Now, consider keeping in mind that birthdays will always be shown in the current year. If you put the date of birth of the event, it can only be seen in that year, this may be obvious, however there are many programmers who are just starting out and the more ideas they have, the better it will be for them. Greetings :D
No hay nada de mágico con los eventos, simplemente es una variable de arreglo cuyo indice es la fecha, corre el ejemplo de la documentacion oficial y depuralo en el navegador para que examines la variable events. Puedes manipular dicha variable agregando mas eventos de la siguiente forma:
Lo cual lo hace dentro del disparador de eventos de pulsar el boton Add elements.addButton.addEventListener("click", function()
Ahora bien si te fijas en la documentacion oficial de jscalendar para eliminar eventos simple y llanamente se sigue trabajando con la variable de arreglo:
Esto ultimo se ve en var removeEvent = function (date, index)
Hello, you could do something like this:
First in the HTML I load the default JsCalendar libraries, then I define my HTML. I will also add a bit of CSS to give a better appearance to the option to add events that is built in a div.
In the JavaScript what I do is define my Jscalendar, a default list of predefined random events is also created, they can be ignored, when clicking on the add button I will get an input to add the name of the event, I add it and I can change between dates and my events will be held... it's a basic guide I hope it helps you. can you see it here