Calendar
Container for displaying data in calendar form.
When To Use#
When data is in the form of dates, such as schedules, timetables, prices calendar, lunar calendar. This component also supports Year/Month switch.
import { NzCalendarModule } from 'ng-zorro-antd/calendar';
Examples
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
25 | 26 | 27 | 28 | 29 | 30 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Loading...
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8
| 9 | 10
| 11
| 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8
| 9 | 10
| 11
|
Loading...
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
Loading...
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
Loading...
Custom header
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
Loading...
API#
Note: Some of Calendar's locale are coming from Angular i18n, that should be provided in the file of app.module.ts
.
For example:
import { registerLocaleData } from '@angular/common';
import en from '@angular/common/locales/en';
registerLocaleData(en);
<nz-calendar
[nzDateCell]="dateCellTpl"
[(ngModel)]="selectedDate"
[(nzMode)]="mode"
(nzPanelChange)="panelChange($event)"
(nzSelectChange)="selectChange($event)"
>
<!-- Another method for cell definition -->
<div *nzDateCell>Foo</div>
</nz-calendar>
<!-- Passing TemplateRef -->
<ng-template #dateCellTpl let-date><span>{{ date | date:'d'}}</span></ng-template>
nz-calendar#
Property | Description | Type | Default |
---|---|---|---|
[(ngModel)] | (Two-way bindable) The current selected date | Date | current date |
[(nzMode)] | The display mode of the calendar (two-way bindable) | 'month' | 'year' | 'month' |
[nzFullscreen] | Whether to display in full-screen | boolean | true |
[nzDateCell] | (Contentable) Customize the display of the date cell, the template content will be appended to the cell | TemplateRef<Date> | - |
[nzDateFullCell] | (Contentable) Customize the display of the date cell, the template content will override the cell | TemplateRef<Date> | - |
[nzMonthCell] | (Contentable) Customize the display of the month cell, the template content will be appended to the cell | TemplateRef<Date> | - |
[nzMonthFullCell] | (Contentable) Customize the display of the month cell, the template content will override the cell | TemplateRef<Date> | - |
[nzCustomHeader] | Render custom header in panel | string | TemplateRef<void> | - |
[nzDisabledDate] | specify the date that cannot be selected | (current: Date) => boolean | - |
(nzPanelChange) | Callback for when panel changes | EventEmitter<{ date: Date, mode: 'month' | 'year' }> | - |
(nzSelectChange) | A callback function of selected item | EventEmitter<Date> | - |