New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

beneroch-calendar

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beneroch-calendar

Javascript plugin that offers a calendar view to interact with data.

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

Calendar

Description

You can find demo here

Home made calendar that covers events and datepicking. Every event on a day in the calendar returns a date object of the current target. Note that even the header triggers these events, with a null object as a date.

For date picking, you can add a onDayClick event and then manage the date object. ( @see onDayClick option below ) Events are passed as a JSON object and each requires a title and a date. The date parameter is mixed, which means it can be a string, a timestamp or an object. It'll be an object if the event has a beginning and an end.

Simple date

[ {
   "date" : "2024/1/10",
   "content" : "",
   "title" : ""
} ]

Complex date

[ {
   "date" : {
       "start" : "2024/1/10",
       "end" : "2024/1/11"
   },
   "content" : "",
   "title" : ""
} ]

Multiple date formats

[ {
   "date" : {
       "start" : "2024/1/10",
       "end" : "january 11 2024"
   },
   "content" : "",
   "title" : ""
},{
   "date" : "september 24 2024",
   "content" : "",
   "title" : ""
} ]

Easy to use

The calendar is easy to use and only requires minimal options. Everything is yet customizable. The calendar builds himself on a DOM object (DIV) and fits the boundaries of that object. Let's see some examples

Given the following div:
<div id="calendar-widget"></div>
Build a calendar without jQuery
let opts = {};
let domElement = document.getElementById('calendar-widget');
let calendar = new bCalendar(domElement, opts); // Same has $('#calendar-widget').calendar(opts)
Build a french calendar (see default options)
$('#calendar-widget').calendar()
Build an english calendar
$('#calendar-widget').calendar({
    lang : 'en'
})
Add unsupported language
$('#calendar-widget').calendar({
    lang : 'customLang',
    translations: {
        months: {
            customLang : ['January', 'February', 'March', 'April','May', 'June', 'July', 'August', 'September','October', 'November', 'December']
        },
        days: {
            customLang : ['S', 'M', 'T', 'W', 'T', 'F', 'S']
        },
        nextMonthLabel : {
            customLang : 'Next Month'
        },
        prevMonthLabel : {
            customLang : 'Previous Month'
        }
        nextYearLabel : {
            customLang : 'Next Year'
        },
        prevYearLabel : {
            customLang : 'Previous Year'
        }
    }
})
Start in month view display
$('#calendar-widget').calendar({
    mode: 'month'
})
Add events
$('#calendar-widget').calendar({
    events : [
        {
            date:"2024/01/16",
            title: 'Test title',
            content : 'Well, turns out on that date we uploaded the plugin'
        },
        {
        date:{
            start: "2024/01/16",
            end: "february 1 2024"
        },
            title: 'Doc title',
            content : 'We also u"<>pdated the doc accordingly'
        },
        {
            date:{
                start : "2024/01/17",
                end : "2024/01/27"
            },
            title: 'Changes',
            content : 'We might add s\0ome changes during theses days'
        }
    ]
});

API (jQuery)

NameDescription
destroyDestroys the calendar by removing all HTML and LISTENERS
nextGoes to next month
prevGoes to previous month
addEventAdds one events to the currently existing events
addEventsAdds multiple events to the currently existing events
setEventsSets the calendar events destroying all previously added events

Options

NameTypeDescription
startDateDate ObjectCurrent display date ( Default: today )
showStartDateBooleanShow indicator of the startDate ( Default: true )
langstringCurrent display language
modestringCurrent display mode. Either month or date ( Default: date )
useControlsbooleanAuto output the controls for next and prev month if set to true (default: true)
allowYearViewbooleanDefine if you can see the year view (default: false, unless mode is set to 'year')
allowMonthViewbooleanDefine if you can see the month view (default: false, unless mode is set to 'month')
eventsobjectJSON of all the events - Events can have pretty much any data, but requires at least a title and a date
displayEventsNumberbooleanDefine if you can to display the number of events on the calendar (default: true)
displayAdjacentMonthDatesbooleanDefine if you want to display the adjacent month dates or empty boxes (default: true)
eventsNumberTemplatestringTemplates used to display the number of events on a day / year / month

translations

NameTypeDescription
monthsobjectLabels for months, by lang, in an array starting from JANUARY to DECEMBER
daysobjectLabels for days, by lang, in an array starting from SUNDAY to SATURDAY
nextMonthLabelobjectLabels for skip month's title, by lang, in an array (view default)
prevMonthLabelobjectLabels for skip month's title, by lang, in an array (view default)
nextYearLabelobjectLabels for skip year's title, by lang, in an array (view default)
prevYearLabelobjectLabels for skip year's title, by lang, in an array (view default)

classes

NameTypeDescription
mainCalendarClassstringThe main calendar class, set on the DIV object that wraps it all
calendarTitleClassstringThe calendar title class, set on the H1 object
calendarControlsClassstringThe calendar controls wrapper class, set on the DIV object that wraps controls
calendarControlsPrevClassstringThe calendar previous month button class, set on the ANCHOR object
calendarControlsNextClassstringThe calendar next month button class, set on the ANCHOR object
calendarTableClassstringThe calendar table class, set on the TABLE object
calendarTableHeaderClassstringThe calendar table header class, set on the TR object that contains the day's labels
calendarRowClassstringThe calendar row class, set on all the other TR object as opposed to 'calendarTableHeaderClass'
calendarDayClassstringThe calendar day class, set on all TD inside the calendar (ALSO in the header)
calendarMonthClassstringThe calendar month class, set on all TD inside the calendar (ALSO in the header)
calendarLinkClassstringThe calendar link class, set on the ANCHOR object inside a day
calendarTextClassstringThe calendar text class, set on the object inside the object of a day (calendarLinkClass)
calendarEventClassstringThe calendar event class, set on the TD wrapping the day with an event
calendarEmptyDayClassstringThe calendar empty day class, set on the TD wrapping a day with no date
calendarCurrentDayClassstringThe calendar current day class, set on the td wrapping today's date
calendarSelectedDayClassstringThe calendar selected day class, set on the td wrapping the selected date
calendarSelectedMonthClassstringThe calendar empty day class, set on the TD wrapping a day with no date

callbacks

NameTypeDescription
onDayMouseOverfunctionTriggered when moving mouse over a day
onEventMouseOverfunctionTriggered when moving mouse over a day with an event
onDayMouseOutfunctionTriggered when moving mouse out of a day
onEventMouseOutfunctionTriggered when moving mouse out of a day with an event
onDayClickfunctionTriggered when clicking on a day
onEventClickfunctionTriggered when clicking on a day with an event
onPrevfunctionTriggered when clicking on the previous button while in date mode / Added to the regular event @see changeMonth
onPrevYearfunctionTriggered when clicking on the previous button while in month mode
onNextfunctionTriggered when clicking on the next button while in date mode / Added to the regular event @see changeMonth
onNextYearfunctionTriggered when clicking on the next button while in month mode
onGotoMonthViewfunctionTriggered after switching to the month view
onGotoDateViewfunctionTriggered after switching to the date view

Keywords

FAQs

Package last updated on 06 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc