Skip to content

Commit 478cdec

Browse files
committed
[update] use bundled date-fns in code examples
1 parent af52f61 commit 478cdec

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/api/config/js_eventcalendar_templates_config.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ To set the templates dynamically, you can use the
6464
### Example
6565

6666
~~~jsx {5-14,16-22,24-30,32-44,46-55,57-63,65-73,75-88,90-97}
67+
const { dateFns, EventCalendar } = eventCalendar;
6768
const { format } = dateFns; // date-fns library (https://date-fns.org/)
68-
new eventCalendar.EventCalendar("#root", { // create Event Calendar
69+
new EventCalendar("#root", { // create Event Calendar
6970
templates: {
7071
// the event template of the "Week" and "Day" modes
7172
weekEvent: ({ event, calendar }) => {

docs/guides/views.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ In all cases, the `config` of the view is passed as the second argument to these
391391
For example, you can create a custom 5-day view by taking the `week` base view and redefining the `getBounds` method. This method adjusts the displayed range to only show Monday to Friday.
392392

393393
~~~jsx
394-
395-
const scheduler = new eventCalendar.EventCalendar("#root", {
394+
const { dateFns, EventCalendar } = eventCalendar;
395+
const calendar = new EventCalendar("#root", {
396396
config: {
397397
views: [
398398
{
@@ -421,6 +421,7 @@ Notice that we didn't redefine the `getNext` and `getPrev` methods. This is beca
421421
Consider another example, Two-Week View with the approrpriate navigation step. In this case you need to override the navigation methods (`getNext` and `getPrev`) in addition to `getBounds`.
422422

423423
~~~jsx
424+
const { dateFns, EventCalendar } = eventCalendar;
424425
const calendar = new EventCalendar("#root", {
425426
config: {
426427
views: [
@@ -451,6 +452,7 @@ const calendar = new EventCalendar("#root", {
451452
By default, the **Agenda** view displays upcoming events starting from the active date. You can redefine this behavior to display events for an entire month, with navigation moving one month at a time.
452453

453454
~~~jsx
455+
const { dateFns, EventCalendar } = eventCalendar;
454456
const calendar = new EventCalendar("#root", {
455457
config: {
456458
views: [

0 commit comments

Comments
 (0)