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

356
Views
get click date in addEvent modal

I'm working on a fullcalendar project. When I click on a day of my calendar it appeared a modal where you put the name of your event, the start date and end date. The input for start and end date is a datetime-local and I was looking for a way that when you click on a day and the modal show up in my start input is already visualize the day.

This is my modal and, for example, when I click on 4th of April it appeared directly like this, without me having to put it manually: like this ->example.

I found online this solution to get the clicked date:

dayClick: function(date, jsEvent, view, resourceObj) {
                    alert(date.format('DD/MM/YYYY 08:00'));   //format i decide
                    
                },

But i dont know how to applied to my code to have it as input and not alert


I found also this way, I like it better because I can add the hour I want:

var startDateSelected = moment(event.startStr).format("DD-MM-YYYY 08:00:00");
var endDateSelected = moment(event.endStr).format("DD-MM-YYYY 17:30:00");

but still havent found a way to applied to my input datelocal-time

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

At the end I found this solution:

select: function select(event, date) {              
    $('#addNewEvent').modal('show');
    $('#calendar').fullCalendar('refetchEvents',event._id);
    var now = new Date(event);
    document.getElementById('starts').value = now.toISOString().slice(0,16);
    document.getElementById('ends').value = now.toISOString().slice(0,16);
}

This is the function that open my modal and fecth the events from my database by ID And the ID mention in getElementById are from my two datetime-local input

I hope someone can find it useful. It refered to Fullcalendar v3 because that the version the template I'm using have

about 4 years ago · Santiago Trujillo Report
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!