PHP code example of webcito / bs-calendar

1. Go to this page and download the library: Download webcito/bs-calendar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webcito / bs-calendar example snippets

javascript
const appointment = {
    title: 'New meeting',
    start: '2026-05-08 10:00:00',
    end: '2026-05-08 11:00:00'
};

$('#calendar').bsCalendar('addAppointment', appointment);
$('#calendar').bsCalendar('editAppointment', {id: appointment.id, title: 'Updated meeting'});
$('#calendar').bsCalendar('deleteAppointment', appointment.id);
json
{
  "id": "weekly-training",
  "title": "Weekly training",
  "start": "2026-06-01 18:00:00",
  "end": "2026-06-01 19:00:00",
  "recurrence": {
    "frequency": "weekly",
    "interval": 1,
    "until": "2026-12-31",
    "daysOfWeek": [1],
    "exceptions": ["2026-07-06"]
  }
}
json
{
  "id": "training",
  "title": "Training",
  "start": "2026-06-01 18:00:00",
  "end": "2026-06-01 19:00:00",
  "recurrence": {
    "frequency": "weekly",
    "daysOfWeek": [1, 3],
    "until": "2026-06-30"
  }
}
json
{
  "id": "team-sync",
  "title": "Team sync",
  "start": "2026-06-02 09:30:00",
  "end": "2026-06-02 10:00:00",
  "recurrence": {
    "frequency": "weekly",
    "interval": 2,
    "until": "2026-08-31",
    "exceptions": ["2026-07-14"]
  }
}
javascript
$('#calendar').bsCalendar({
    appointmentRules: {
        durationStepMinutes: 30,
        minDurationMinutes: 30,
        maxDurationMinutes: 120
    }
});
javascript
const hourNumber = $.bsCalendar.utils.parseTimeToDecimal('08:30'); // output -> 8.5
const appointments = $.bsCalendar.utils.convertIcsToAppointments(icsString);
const date = $.bsCalendar.utils.parseDateInput('2026-05-08 10:00:00');
const normalized = $.bsCalendar.utils.normalizeDateTime('2026-05-08 10:00');
const time = $.bsCalendar.utils.formatTime(date);
const dateString = $.bsCalendar.utils.formatDateToDateString(date);
const localizedDate = $.bsCalendar.utils.formatDateByLocale(date, 'de-DE');
const week = $.bsCalendar.utils.getCalendarWeek(date);
const weekdays = $.bsCalendar.utils.getShortWeekDayNames('de-DE', false);
const sameDay = $.bsCalendar.utils.datesAreEqual(new Date(), date);
const label = $.bsCalendar.utils.getAppointmentTimespanBeautify(extras, true);