Have you ever needed to add a calendar to your web page, but didn't want to implement your own? This widget is for you. With a simple interface to customize your calendar, this can be easily added to any project. The calendar is implemented in JavaScript, with some CSS added for basic structure.
There is customization available through both CSS and JavaScript
In your CSS, you can customize the look of the calendar using the following selectors:
#calendar
#calendar-title
#calendar-days
.day
#highlighted-day
However, when customizing, do not use the following attributes:
display
grid-template-columns
grid-template-rows
grid-auto-flow
grid-column
grid-row
To create a calendar, simply call create_calendar(year, month)
,
where year
and month
are integer values representing the year and the month.
The month is 0-based, which means that January is 0
, February is 1
, and December is 11
.
create_calendar
returns an object with the following functions:
get_calendar()
: returns a DOM object that can be inserted into the HTMLset_calendar_title(new_title)
: sets the title of the calendarhighlight_day(day_of_month)
: highlights the given day of the month
Find an issue? Feel free to report it! I'll fix it as soon as I can.
Pull requests are welcome. Feel free to fix bugs, respond to issues, or add your own improvements. Just make sure that you explain what you did in your request.