Search results

Customize Day Header in JavaScript Calendar control

15 Oct 2021 / 1 minute to read

You can change the format of the day that to be displayed in header using dayHeaderFormat property. By default, the format is Short.

You can find the possible formats on below.

Name Description
Short Sets the short format of day name (like Su ) in day header.
Narrow Sets the single character of day name (like S ) in day header.
Abbreviated Sets the min format of day name (like Sun ) in day header.
Wide Sets the long format of day name (like Sunday ) in day header.
Copied to clipboard
import { Calendar } from '@syncfusion/ej2-calendars';
import { DropDownList } from '@syncfusion/ej2-dropdowns';

let calendarObject: Calendar = new Calendar({
    dayHeaderFormat: "Short"

let formatLabel: DropDownList = new DropDownList({
        // set the height of the popup element
        popupHeight: '200px',
        // bind the change event
            change: (args: any) => {
                 calendarObject.dayHeaderFormat = args.value;
Copied to clipboard
<!DOCTYPE html>
<html lang="en">

    <title>Essential JS 2 Calendar control</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="styles.css" rel="stylesheet" />
   <!--style reference from the Calendar component-->
    <link href="//" rel="stylesheet" />
    <link href="//" rel="stylesheet" />     
    <link href="//" rel="stylesheet" />
    <link href="//" rel="stylesheet" />
    <link href="//" rel="stylesheet" />
    <link href="//" rel="stylesheet" />
    <script src=""></script>
    <script src="systemjs.config.js"></script>

    <div id='loader'>LOADING....</div>
    <div id='container'>
        <!--element which is going to render the Calendar-->
        <div id='element'></div>
    <div id="format">
        <label class="custom-input-label">Header Format Types</label>
        <div id="wrapper">
            <select id="select" class="form-control">
                <option value="Short" selected>Short</option>
                <option value="Narrow">Narrow</option>
                <option value="Abbreviated">Abbreviated</option>
                <option value="Wide">Wide</option>

Copied to clipboard
#container {
    margin: 30px auto;
    width: 60%;
    display: inline-flex;

#format { 
    width: 30%;
    display: inline-block;
    margin-left: 8%;

#wrapper {
    height: 30px;
    width: 150px;
    margin-top: 10px;

    font-size: 16px;
    font-weight: bold