What is the method to prolong the end date of fullCalendar.js through Javascript?

I am facing the same issue as this individual. I am unsure of how to add one day to the end date. I do not want to alter the database value, only modify it on the HTML page.

Currently, this is my calendar (no Moment.js joke intended):

$(document).ready(function () {

   // The page is now ready, let's initialize the calendar...
   var base_url = '{{ url('/') }}';
   var $calendar = $('#calendar-holidays').fullCalendar({
   header: {
      left: '',
      center: 'title',
      right: ''
      },
   weekends: false,
   editable: false,
   eventLimit: true,
   events: {
      url: base_url + '/holidayapi',
      error: function () {
         alert("Cannot retrieve holidays from the database");
      },
   }
});

Answer №1

In case your event objects already include an end date specified

$('#calendar').fullCalendar({
  /* assuming that the end date is included in the event object */
  eventDataTransform: function(event) {
    var duplicate = $.extend({}, event);
    duplicate.end = moment(event.end).add(1, 'day'); // create a moment object if missing
    return duplicate;
  },
  events: [{ /* example event */
    start: moment().format('YYYY-MM-DD'),
    // all day event, with end set for the following day @ 00:00
    end: moment().add(1,'day').format('YYYY-MM-DD'),
    title: 'Event today'
  }]
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to modify the document title using .ready()?

As I work with nested layouts in Ruby on Rails, one particular layout requires me to extract a string from a div and use it as the title of the document. What is the proper method (if there is one) to accomplish this task? <script type="text/javascri ...

Issues arise when using res.send() with ExpressJS and Mongoose

Initially, I have multiple callbacks that need to be executed before sending a res.send() to construct a JSON API: app.get('/api', function (req, res){ ... function logPagesId() { console.log("load: " +pagesId); c ...

Add an array into an object using $set (properties remain unchanged)

I have an object with the following structure: obj: { 1: { 'a': [ [] ], 'b': [ [] ] } } Now, I am attempting to append 'c' => [ [] ] to this object in a watcher. My first attempt was using this.obj[1][&apo ...

Tips for customizing plupload to prompt the user for a file title

I have successfully implemented plupload on my website to allow users to upload photos, and I am also using the jQuery queue widget. My current server method only accepts the filename, chunk, and content of the photo. Is there a way for users to specify a ...

What is the method for accessing JSON data?

Looking for assistance on a coding issue I'm facing. I need my JavaScript code to read JSON data and grant access to a staff panel based on the information provided. Below is the sample JSON: { "User1": { "User": " ...

"Trouble with React JS redirection feature failing to redirect as intended

Could someone please help me troubleshoot why the redirect function is not working in my code? There are no error messages showing up, but it seems like the Redirect call from the react-router-dom library is causing a problem. The console log displays &apo ...

importing a text file into the appropriate input field on an HTML form

I've been experimenting with this JavaScript code and I can't seem to get it to work as intended. The code is designed to save the value of a single textbox into a text file that can later be loaded back into the same textbox. However, I'm f ...

How to properly escape JSON with hyphen or dash in AngularJS ngSrc

Having trouble displaying an image from a json url with dashes. I attempted to use bracket notation but it does not seem to be functioning: <img ng-src="{{image.['small-size'].url || image.thumb}}"> When using single quotes, my angular vi ...

transferring data from one HTML file to another using a loop with technologies such as HTML,

As a beginner in front end development, I am finding it a bit challenging at the moment. Here's what I have so far: 1 main HTML file (index.html) 1 JavaScript file (something.js) 2nd HTML file (something.html) Main HTML: <!DOCTYPE html> < ...

Adding code containing various Google Maps elements in a fresh browser window using JavaScript

I've encountered an issue while trying to create a new page with a Google map and title based on the button clicked. Interestingly, when I copy/paste the HTML in the "newhtml" variable into an actual HTML file, it works perfectly fine. However, it doe ...

The getBBox() method of SVG:g is returning an incorrect width value

Hey there, I've been attempting to determine the width of a <g> element and it consistently returns 509.5 pixels regardless of what I do. Initially, I assumed this was the actual size and not scaled. However, upon opening the SVG in Illustrato ...

Is it better to utilize AngularJS $http service for making requests, or should I opt for jQuery AJAX if available

When working on my project, I rely on the angularjs framework and always enjoy utilizing the $http service for ajax calls. However, I have come across situations in the project where the UI is not directly impacted by the ajax call and angularjs bindings a ...

Utilizing React JS to call a static function within another static function when an HTML button is clicked

Can you please analyze the following code snippet: var ResultComponent = React.createClass({ getInitialState: function () { // … Some initial state setup ……. }, handleClick: function(event) { // … Handling click event logic …… // Including ...

The Angular Google Maps Module fails to initialize

After updating angular-google-maps to version 2.0.1 via bower and adding the required dependencies (bluebird, jquery, loadash), I noticed that my app works fine when I comment out google-maps. This suggests that the issue lies with angular-google-maps. He ...

Unable to save the session identifier from the response headers while utilizing sessions in react/frappe framework

I am attempting to retrieve the session id (sid) from the response headers in a unique scenario. My client application is situated on a local environment, while my API is hosted on an ERP Next server. Upon sending a login request from the React app, I am ...

A step-by-step guide on how to use the Google Closure Compiler: a

Is there anyone who could assist me in adding a snippet to the basic process of Google Closure Compiler? I have been trying unsuccessfully to do this via JavaScript code. I am using an example snippet from the official npm page, but when I run it, someth ...

Potential issue with Jhipster: loading of data could be experiencing delays

I've encountered an issue with getting my chart to display properly. I am working on creating a chart using ng2-charts, where I retrieve data from a service and then display it on the chart. The problem arises when the data is not correctly displayed ...

Using vue-resource to intercept an ajax error and catching the "Uncaught (in promise)" exception

I am utilizing vue-resource to retrieve data from the server. In order to access the correct data, a user must possess a JWT token. If the token is invalid or has expired, a status code of 401 will be returned. Similarly, if a user attempts to reach a forb ...

Why isn't my JavaScript Alert displaying a string message?

I'm feeling a bit puzzled and I have a feeling there must be an easy solution, so please lend me a hand. Here's the code snippet that is causing me some confusion: $new = "1"; <script language="javascript"> alert(<?php echo $new; ...

Learn the process of developing a web client application using Node.js and NPM similar to the AngularJS tutorial

I am new to nodejs, npm and angularjs. I recently explored the angularjs tutorial project available at https://github.com/angular/angular-phonecat.git. This project has been really interesting for me as it demonstrates how easy it is to manage modules wi ...