document.addEventListener('DOMContentLoaded', function () {
        var calendarEl = document.getElementById('calendar');
        let date = new Date();//original date
        let firstDay = new Date();
        firstDay.setDate(date.getDate() + 1); //Set firstDay to the day after date
        firstDay = firstDay.toJSON().slice(0, 10); //Converts firstDay to a string in the format 'yyyy-mm-dd'
        let yearBehind = new Date();
        yearBehind.setYear(date.getYear() - 1);
        yearBehind = yearBehind.toJSON().slice(0, 10);
        let yearAhead = new Date();
        yearAhead.setYear(date.getYear() + 1);
        yearAhead = yearAhead.toJSON().slice(0, 10);
        let randomDay = new Date();
        randomDay.setDate(date.getDate() + 4);
        date = date.toJSON().slice(0, 10);

        var calendar = new FullCalendar.Calendar(calendarEl, {
            headerToolbar: {
                left: 'today next',
                center: 'title',
                right: 'dayGridMonth'
            },
            initialDate: firstDay,
            selectable: true,
            selectMirror: true,
            select: function (arg) {
                var start = arg.start;// the date the user selected
                var end = arg.end;
                var nextDay = new Date(start);
                nextDay.setDate(start.getDate() + 1); // add one day to start

                if (nextDay.toISOString().slice(0, 10) != end.toISOString().slice(0, 10)) {
                    calendar.unselect();//forces you to only select one day
                } else {
                    var userResponse = confirm("Are you sure you want to book this day?");
                    if (userResponse) {
                        $.ajax({
                            url: '/Controller/StoreDate/SaveDate',
                            type: 'POST', // HTTP method, use POST to send data
                            data: { 'data': start }, // Data sent to server
                            success: function (response) {
                                // This function runs if the request succeeds
                                console.log(response);
                            },
                            error: function (error) {
                                // This function runs if the request fails
                                console.log(error);
                            }
                        });
                        window.location.href = "/Home/Index";//sends you to another page when you're done
                    }
                }
            },
            events: [
                {
                    groupId: 'available',
                    start: firstDay,
                    end: yearAhead,
                    display: 'background'
                },
                {
                    start: firstDay,//offer days
                    end: randomDay,
                    display: 'background',
                    color: 'dimgrey'
                },
                {
                    groupId: 'unavailable',
                    start: yearBehind,//unavailable days
                    end: date,
                    display: 'background',
                    color: '#ff9f89'
                }
            ]
        });

        calendar.render();
    });

Javascript相关代码片段

currency formatter js

image to text react native

Nodejs image uploader

jquery check if in viewport

parallax effect download js

jsx Nextjs, dashboard, kazi, zobaidul kazi

expect function to throw error vite/jest

react toastify promise

make.com arrays

react flex

javascript object.fromentries

format json without quotes

wordpress page keeps reloading

nodelist javascript

angular refresh page after submit

unminify js

jquery class contains text

ajax to controller not mapping list of ints

pdf.js shortcode

js length of string

ng build prod not working

or truth table

js or symbol

Git - Ignore node_modules folder everywhere

.net and javascript date functions format

js element in viewport

object detection in react native

remove repeated elements in array javascript

useTransission react

custom cursor for react

react get blue outline on routing Links

get rid of blue button effect on react links

nextjs remote url image

react router v6 basic code

lua table to json online

download video from url javascript

jquery set max length input

JS not selecting the element

react native clock

shadcn toast not showing

express folder structure

audio element

javascript set display of elem to block

react phone number input

tailwind intellisense not working with react

cannot find name 'cy'

submit form react

footer react bootstrap

angular interview questions and answers

trigger alert if button is clicked

change query params

verify control code iban javascript

react-spring

Next JS solve the Hydration error

how can i set a new expo project

generate aes key

storage capacity on browser

nix flake Javascript projects

reset udemy course progress

zod Input file schema with shadcn

wordpress rest api print json pretty

extract string csv js

remove extra space string javascript

count letters in string javascript

exract string js

lazygit nvim

ex:javascript loop

js slice last element

Multiply a number with .17 and round up to .25

sweetalert 2

booking calendar js

process.env is kept

AnimationEvent has no function name specified!

jquery date picker wordpress enque

js check in view

settimeout event in input in javascript in react

node option size

docker react app

React Modal using Dialog

how to create dynamic object in javascript