Working days in Vue Schedule component
12 Jul 202424 minutes to read
The Scheduler can be customized on various aspects as well as it inherits almost all the calendar-specific features such as options,
- To set custom time range display on Scheduler
- To set different working hours
- To set different working days
- To set different first day of week
- To show/hide weekend days
- To show the week number
Set working days
By default, Scheduler considers the week days from Monday to Friday as Working days
and therefore defaults to [1,2,3,4,5] - where 1 represents Monday, 2 represents Tuesday and so on. The days which are not defined in this working days collection are considered as non-working days. Therefore, when the weekend days are set to hide from Scheduler, all those non-working days too gets hidden from the layout.
The Work week and Timeline Work week views displays exactly the defined working days on Scheduler layout, whereas other views displays all the days and simply differentiates the non-working days on UI with inactive cell color.
The working or business hours depiction on Scheduler are usually valid only on these specified working days.
The following example code depicts how to set the Scheduler to display Monday, Wednesday and Friday as working days of a week.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' :selectedDate='selectedDate' :eventSettings='eventSettings'
:currentView='currentView' :workDays='workDays'>
<e-views>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
<e-view option='Month'></e-view>
<e-view option='TimelineWeek'></e-view>
<e-view option='TimelineWorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Week, WorkWeek, Month, TimelineViews } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const currentView = 'WorkWeek';
const workDays = [1, 3, 5];
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Week, WorkWeek, Month, TimelineViews]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' :selectedDate='selectedDate' :eventSettings='eventSettings'
:currentView='currentView' :workDays='workDays'>
<e-views>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
<e-view option='Month'></e-view>
<e-view option='TimelineWeek'></e-view>
<e-view option='TimelineWorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Week, WorkWeek, Month, TimelineViews } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
currentView: 'WorkWeek',
workDays: [1, 3, 5],
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Week, WorkWeek, Month, TimelineViews]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Hiding weekend days
The showWeekend
property is used to either show or hide the weekend days of a week and it is not applicable on Work week view (as non-working days are usually not displayed on work week view). By default, it is set to true
. The days which are not a part of the working days collection of a Scheduler are usually considered as non-working or weekend days.
Here, the working days are defined as [1, 3, 4, 5] on Scheduler and therefore the remaining days (0, 2, 6 – Sunday, Tuesday and Saturday) are considered as non-working or weekend days and will be hidden from all the views when showWeekend
property is set to false
.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:workDays='workDays' :showWeekend='showWeekend'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='TimelineMonth'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, TimelineMonth } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const showWeekend = false;
const workDays = [1, 3, 4, 5];
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Day, Week, TimelineMonth]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:workDays='workDays' :showWeekend='showWeekend'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='TimelineMonth'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, TimelineMonth } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
showWeekend: false,
workDays: [1, 3, 4, 5],
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Day, Week, TimelineMonth]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Show week numbers
It is possible to show the week number count of a week in the header bar of the Scheduler by setting true to showWeekNumber
property. By default, its default value is false
. In Month view, the week numbers are displayed as a first column.
The
showWeekNumber
property is not applicable on Timeline views, as it has the equivalent headerRows property to handle such requirement with additional customizations.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:currentView='currentView' :showWeekNumber='showWeekNumber'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='Month'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, Month } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const currentView = 'Month';
const showWeekNumber = true;
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Day, Week, Month]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:currentView='currentView' :showWeekNumber='showWeekNumber'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='Month'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, Month } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
currentView: 'Month',
showWeekNumber: true,
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Day, Week, Month]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Different options in showing week numbers
By default, week numbers are shown in the Scheduler based on the first day of the year. However, the week numbers can be determined based on the following criteria.
FirstDay
– The first week of the year is calculated based on the first day of the year.
FirstFourDayWeek
– The first week of the year begins from the first week with four or more days.
FirstFullWeek
– The first week of the year begins when meeting the first day of the week (firstDayOfWeek) and the first day of the year.
For more details refer to this link
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:currentView='currentView' :showWeekNumber='showWeekNumber' :weekRule='weekRule'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='Month'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, Month } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const currentView = 'Month';
const showWeekNumber = true;
const weekRule = 'FirstFourDayWeek';
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Day, Week, Month]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:currentView='currentView' :showWeekNumber='showWeekNumber' :weekRule='weekRule'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='Month'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, Month } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
currentView: 'Month',
showWeekNumber: true,
weekRule: 'FirstFourDayWeek',
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Day, Week, Month]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Note: Enable the showWeekNumber
property to configure the weekRule
property. Also, the weekRule property depends on the value of the firstDayOfWeek
property.
Set working hours
Working hours indicates the work hour limit within the Scheduler, which is visually highlighted with an active color on work cells. The working hours can be set on Scheduler using the workHours
property which is of object type and includes the following sub-options,
-
highlight
– enables/disables the highlighting of work hours. -
start
- sets the start time of the working/business hour of a day. -
end
- sets the end time limit of the working/business hour of a day.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:workHours='workHours'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, WorkWeek } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const workHours = {
highlight: true,
start: '11:00',
end: '20:00'
};
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Day, Week, WorkWeek]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:workHours='workHours'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, WorkWeek } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
workHours: {
highlight: true,
start: '11:00',
end: '20:00'
},
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Day, Week, WorkWeek]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Scheduler displaying custom hours
It is possible to display the event Scheduler layout with specific time durations by hiding the unwanted hours. To do so, set the start and end hour for the Scheduler using the startHour
and endHour
properties respectively.
The following code example displays the Scheduler starting from the time range 7.00 AM to 6.00 PM and the remaining hours are hidden on the UI.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
startHour='07:00' endHour='18:00'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, WorkWeek } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Day, Week, WorkWeek]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
startHour='07:00' endHour='18:00'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, WorkWeek } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Day, Week, WorkWeek]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Setting start day of the week
By default, Scheduler defaults to Sunday
as its first day of a week. To change the Scheduler’s start day of a week with different day, set the firstDayOfWeek
property with the values ranging from 0 to 6.
Here, Sunday is always denoted as 0, Monday as 1 and so on.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:firstDayOfWeek='firstDayOfWeek'>
<e-views>
<e-view option='Week'></e-view>
<e-view option='Month'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Week, Month } from '@syncfusion/ej2-vue-schedule';
const selectedDate = new Date(2018, 1, 15);
const firstDayOfWeek = 3;
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Week, Month]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings'
:firstDayOfWeek='firstDayOfWeek'>
<e-views>
<e-view option='Week'></e-view>
<e-view option='Month'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Week, Month } from '@syncfusion/ej2-vue-schedule';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
firstDayOfWeek: 3,
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Week, Month]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
Scroll to specific time and date
You can manually scroll to a specific time on Scheduler by making use of the scrollTo
method as depicted in the following code example.
<template>
<div>
<div id='app'>
<div>
<ejs-timepicker width='100' :value='date' format='HH:mm' :change='onChange'>
</ejs-timepicker>
</div>
<div id='container'>
<ejs-schedule ref='ScheduleObj' height='510px' width='100%' :selectedDate='selectedDate'
:eventSettings='eventSettings'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide, ref } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, WorkWeek } from '@syncfusion/ej2-vue-schedule';
import { TimePickerComponent as EjsTimepicker } from '@syncfusion/ej2-vue-calendars';
const ScheduleObj = ref(null);
const selectedDate = new Date(2018, 1, 15);
const eventSettings = { dataSource: scheduleData };
const date = new Date(2000, 0, 1, 9);
provide('schedule', [Day, Week, WorkWeek]);
const onChange = function (args) {
ScheduleObj.value.ej2Instances.scrollTo(args.text);
}
</script>
<style>
@import "../../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div>
<ejs-timepicker width='100' :value='date' format='HH:mm' :change='onChange'>
</ejs-timepicker>
</div>
<div id='container'>
<ejs-schedule ref='ScheduleObj' height='510px' width='100%' :selectedDate='selectedDate'
:eventSettings='eventSettings'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='WorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, WorkWeek } from '@syncfusion/ej2-vue-schedule';
import { TimePickerComponent } from '@syncfusion/ej2-vue-calendars';
export default {
name: "App",
components: {
"ejs-timepicker": TimePickerComponent,
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
eventSettings: { dataSource: scheduleData },
date: new Date(2000, 0, 1, 9)
}
},
provide: {
schedule: [Day, Week, WorkWeek]
},
methods: {
onChange: function (args) {
this.$refs.ScheduleObj.ej2Instances.scrollTo(args.text);
}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
How to scroll to current time on initial load
There are scenarios where you may need to load the Scheduler displaying the system’s current time on the currently visible view port area. In such cases, the Scheduler needs to be scrolled to a specific time based on the system’s current time which is depicted in the following code example.
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule ref='scheduleObj' height='550px' width='100%' :selectedDate='selectedDate'
:eventSettings='eventSettings' :created='onCreated'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='TimelineWorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script setup>
import { provide, ref } from "vue";
import { scheduleData } from './datasource.js';
import { ScheduleComponent as EjsSchedule, ViewDirective as EView, ViewsDirective as EViews, Day, Week, TimelineViews } from '@syncfusion/ej2-vue-schedule';
import { Internationalization } from '@syncfusion/ej2-base';
const scheduleObj = ref(null);
const selectedDate = new Date(2018, 1, 15);
const eventSettings = { dataSource: scheduleData };
provide('schedule', [Day, Week, TimelineViews]);
const onCreated = function () {
let intl = new Internationalization();
scheduleObj.value.scrollTo(intl.formatDate(new Date(), { skeleton: 'Hm' }));
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
<template>
<div>
<div id='app'>
<div id='container'>
<ejs-schedule ref='scheduleObj' height='550px' width='100%' :selectedDate='selectedDate'
:eventSettings='eventSettings' :created='onCreated'>
<e-views>
<e-view option='Day'></e-view>
<e-view option='Week'></e-view>
<e-view option='TimelineWorkWeek'></e-view>
</e-views>
</ejs-schedule>
</div>
</div>
</div>
</template>
<script>
import { scheduleData } from './datasource.js';
import { ScheduleComponent, ViewDirective, ViewsDirective, Day, Week, TimelineViews } from '@syncfusion/ej2-vue-schedule';
import { Internationalization } from '@syncfusion/ej2-base';
export default {
name: "App",
components: {
"ejs-schedule": ScheduleComponent,
"e-views": ViewsDirective,
"e-view": ViewDirective
},
data() {
return {
selectedDate: new Date(2018, 1, 15),
eventSettings: { dataSource: scheduleData }
}
},
provide: {
schedule: [Day, Week, TimelineViews]
},
methods: {
onCreated: function () {
let intl = new Internationalization();
this.$refs.scheduleObj.scrollTo(intl.formatDate(new Date(), { skeleton: 'Hm' }));
}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";
</style>
You can refer to our Vue Scheduler feature tour page for its groundbreaking feature representations. You can also explore our Vue Scheduler example to knows how to present and manipulate data.