This standalone event calendar can be used to display events that do not reside on the main NYC.gov events calendar. It is simple to update and is accessible for screen readers and keyboard users. The events are entered and stored in a simple comma-separated values (CSV) file that can be edited in a spreadsheet or text editor application. This calendar was created by Tim Keane and was modified to be used on Nyc.gov agency websites.
Only one calendar can reside on the page. To add the calendar to a page, include the style sheet to the page meta data. The javascript library files can be added to the page meta data or in the page text Data Content Records (DCR).
<link href="/assets/home/css/pages/agencies/CsvEventCalendar.css" rel="stylesheet" type="text/css">
<script src="/assets/home/js/libs/papaparse.min.js"></script> <script src="/assets/home/js/libs/jquery-3.4.1.min.js"></script> <script src="/assets/home/js/pages/agencies/CsvEventCalendar.js"></script>
Add the following into the page text Data Content Records (DCR):
<script> $(document).ready(function () { var calendar1 = new CsvEventCalendar({ target: $('#calendar'), url: '/assets/process/data/calendar.csv', }); window.calendar1=calendar1;
});
</script><div id="calendar"></div>
The target
variable attribute needs to reference the HTML element ID that the calendar will render. It is recommended to contain the calendar in a <div>
with the target ID. The url
variable is where the calendar csv file will reside.
date | name | start | end | location | about |
---|---|---|---|---|---|
2023-01-01 | New Year's Day Brunch | 11:00 am | 3:30PM | 890 Nostrand Ave, Brooklyn, NY 11225 | Green eggs and ham |
2023-01-16 | MLK Day Event | 12:00 am | 12:00 pm | Central Park | Many speakers |
2023-03-17 | St. Patrick's Day Parade | 5th Ave | Long walk |