Experiencing issues with properly rendering the Bootstrap year calendar and encountering difficulties with the date picker functionality

Having trouble implementing the bootstrap-year-calendar on my website. The JavaScript functionality and the display of the calendar are not working as expected.

I want to show the calendar horizontally like the example in the link, but it is currently displaying vertically, requiring scrolling to view more months;

Please check the current display of the calendar on my website.


Another issue arises when creating new events. Upon selecting a date, an error occurs:


Additionally, updating or deleting existing events does not work properly.

You can view all my HTML code below:

<!DOCTYPE html>
...
</html>

Here is the calendar JS file:

function editEvent(event) {
    ...
}

$(function() {
    var currentYear = new Date().getFullYear();
    
    $('#calendar').calendar({
        // Calendar settings
    });
    
    $('#save-event').click(function() {
        saveEvent();
    });
});

If you have any suggestions on how I can improve the way this question is presented, please feel free to leave your feedback in the comments.

Thank you.

Answer №1

To address your horizontal alignment problem, consider incorporating specific CSS styles into your project to change the layout from vertical to horizontal.

I recommend utilizing flexbox techniques:

.wrapper-class {
    display: flex;
    flex-direction: row;
}

You can also add additional CSS for improved aesthetics, depending on your preferences. As for the JavaScript errors you encountered, they appear to be caused by mistakes in your code rather than any issues with the library. Take some time to identify and correct these errors.

For instance:

TypeError: null is not an object (evaluating 't.length')

This error typically indicates that you are trying to access the length property of something that does not have one.

Keep in mind that posting complex questions on platforms like Stack Overflow may not always guarantee a quick solution unless you offer a bounty or get lucky with a helpful response.

Best of luck!

Answer №2

Don't forget to add this code snippet to your HTML:

<div class="modal fade" id="event-modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Event</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
            </div>
            <div class="modal-body">
                <input type="hidden" name="event-index">
                <form class="form-horizontal">
                    <div class="form-group row">
                        <label for="event-name" class="col-sm-4 control-label">Name</label>
                        <div class="col-sm-8">
                            <input id="event-name" name="event-name" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="event-location" class="col-sm-4 control-label">Location</label>
                        <div class="col-sm-8">
                            <input id="event-location" name="event-location" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="min-date" class="col-sm-4 control-label">Dates</label>
                        <div class="col-sm-8">
                            <div class="input-group input-daterange" data-provide="datepicker">
                                <input id="min-date" name="event-start-date" type="text" class="form-control">
                <div class="input-group-prepend input-group-append">
                    <div class="input-group-text">to</div>
                </div>
                                <input name="event-end-date" type="text" class="form-control">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-primary" id="save-event">
                    Save
                </button>
            </div>
        </div>
    </div>
</div>
<div id="context-menu">
</div>

Make sure to include Bootstrap in your page, you can find more information at getbootstrap.com

Remember to also include jQuery and Popper.js as per the instructions on the Bootstrap page.

Add this CSS snippet to style your elements:

.calendar table.month td.day .day-content {
    padding: 6px;
    border-radius: 100%;
}

.calendar .months-container .month-container.month-3{
    width:21%;
}

Experiment with the padding and width values until it looks perfect!

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

Retrieving the initial item from a Response.Json() object

i have a this code: fetch("https://rickandmortyapi.com/api/character/?name=Rick") .then((response) => { response.json().then((data) => { console.log(JSON.stringify(data)) }).catch( (error) => { console.log(`Error: $ ...

What are the different techniques for implementing React-Redux? Comparing Redux-thunk and Redux-Saga

My understanding of Redux is still quite hazy as I delve into various techniques and methods. I am curious to learn about other methods similar to redux-Thunk and redux-saga. Each utilizes distinct functions such as CreateSlice. I am interested to know w ...

Get rid of the inner image border using CSS

Can someone assist me in removing the border inside this image using CSS? The border of the image is problematic. Here is an example: https://i.sstatic.net/dcnpS.jpg Thank you..! ...

Ways to retrieve and update the state of a reactjs component

I'm facing an issue with modifying a React JS component attribute using an event handler. export default interface WordInputProps { onWordChange:(word:string) => void firstLetter:string disabled?:boolean } These are the props for my co ...

What is the method for including a class in the anchor element that is the closest sibling of the containing ul element in the HTML structure?

I'm currently exploring traversal in jQuery and I'm a bit confused about how the class is being added to all the items in the unordered list. I know it's probably something simple that I'm missing. Any assistance would be greatly apprec ...

The JQuery video player's full screen toggle feature is not correctly assigning the class name

I've been tackling a bug in my JavaScript/jQuery video player that has left me stumped. One of the key features of this player is an enter/exit full-screen button located at the bottom of the HTML snippet: (function($) { /* Helper functions */ ...

What is the source of these additional pixels that appear when percentages are used for defining height?

I have been working on implementing a sticky footer that I've successfully used in the past for various websites. You can find the link to the original method here: However, this time I am facing a challenge as I want to make the footer more responsi ...

What is the reason for the attribute align="center" functioning in my HTML document?

Recently, I decided to delve into the world of HTML and created a simple basic file: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> My Webpage </title </head> ...

Utilizing conditional statements within the array.forEach method to select specific sub-objects within an array of objects

Need help troubleshooting an if statement inside a function that is called by a forEach array loop. My array contains objects, with each object structured like this: arrofobj = [ {"thing_id":"1a", "val": 1, "Type": "Switch","ValType":{"0":"Open","1":" ...

Hiding and displaying DIVs on a single HTML page using VueJs 2

I am currently working on building an application that is not a single page application. As I develop my project, I have several div elements on the page that I want to toggle visibility step by step. Below is the snippet of my code: <div v-if="sect ...

Exploring the process of retrieving parameters within a component using React Router DOM version 4

I am struggling with the following code: <BrowserRouter> <Route path="/(:filter)?" component={App} /> </BrowserRouter> In previous versions of React Router, wasn't the filter param or '' on the root supposed to be in ...

Using the JavaScript selectionchange event to target a specific element exclusively

I am looking for a way to incorporate a JavaScript selectionchange event on a specific div element. The goal is to display a highlighter box when the user selects text from the DOM. I was able to achieve this functionality for web using an onmouseup event, ...

Send both files and objects simultaneously in a single AJAX request

I am facing a challenge with sending data and files in the same AJAX request. Despite trying various solutions, the controller always returns null (although files are sent successfully and changing the Tester class to a simple string also works). Here is ...

Nativescript encountered an issue while attempting to generate the application. The module failed to load: app/main.js

I'm currently experimenting with the sample-Groceries application, and after installing NativeScript and angular 2 on two different machines, I encountered the same error message when trying to execute: tns run android --emulator While IOS operations ...

The transparency of the image remains slightly see-through even after adjusting the opacity value

Functionality: The current page design includes a translucent background with an opacity of 0.68, and an image placed on top with a full opacity of 1.0. However, the issue arises when the image inherits the transparency property from the background. The g ...

What is the process for translating HTML elements into JSX format?

I have a couple of inquiries. 1.) I am working on a basic reactjs component. How can I transform it into JSX? I want the code to follow the reactjs style. 2.) If I receive an array from the backend in this format [ '/parent-folder-1/child-folder ...

Discovering the best way to choose a button from every button group at once (non-radio) in Bootstrap

Whenever I choose a button from one group, it works perfectly. However, when I select a button from the next group, it seems to forget the selection I made in the first group. This is a common issue that has been discussed on Stack Overflow multiple times. ...

cycle through several handlebars entities

Hey friends, I could really use your help right now. I'm attempting to iterate through these objects using handlebars. RowDataPacket { idUser: 1, username: 'xxxxxx', password: 'xxxxx', fullname: 'Julian Rincon'}, RowDat ...

Exploring the implementation of waterfall in a Node.js application

async.traverse(map, function(item, tnext){ async.waterfall([ function(wnext){ console.log("One"); //performing MongoDB queries db.collection.find().toArray(function(err){ if(err){ ...

Optimizing web content for iOS Safari with min-height media queries

I'm currently working on a Bootstrap-based photo browser that needs to have a responsive 4:3 aspect ratio. To achieve this, I have implemented the following approach: #carousel { width: 320px; height: 240px; ... } Additionally, I utilize media ...