---
title: "Angular Calendar Quarter and Year View Example | Mobiscroll"
component: "Calendar"
framework: "Angular"
library_version: "6.2.0"
url: "https://demo.mobiscroll.com/angular/calendar/quarter-year-view"
---

# Quarter and Year View - Angular Calendar demo

An Angular date picker with switchable quarter and year views — select dates across a 3-month grid or all 12 months at once.

- [Live demo](https://demo.mobiscroll.com/angular/calendar/quarter-year-view)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-angular/tree/main/src/demos/datepicker/calendar/quarter-year-view)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/calendar/quarter-year-view.md), [jQuery](https://demo.mobiscroll.com/jquery/calendar/quarter-year-view.md), [React](https://demo.mobiscroll.com/react/calendar/quarter-year-view.md), [Vue](https://demo.mobiscroll.com/vue/calendar/quarter-year-view.md)

## Description

Create a calendar with quarter views that can be navigated quarter by quarter or switch to a year view on the fly. Show any relevant information with [labels or add background colors](https://demo.mobiscroll.com/angular/calendar/dots-colors-labels) to days along with [week counters](https://demo.mobiscroll.com/angular/calendar/month-change-direction-week-numbers-outer-days).

## What this demo shows

- A date picker calendar with a segmented control for switching between quarter and year views.
- **Header and segmented control:** The centered segmented control provides `Q1`, `Q2`, `Q3`, `Q4`, and `Year` options. It sits between the year quick navigation label on the left and the previous and next navigation arrows on the right.
- **Quarter view:** The current quarter is selected by default, displaying its three months in a compact multi-month grid.
- **Year view:** Selecting `Year` displays all 12 months of the current year in a single scrollable layout.
- **Month calendars:** Each month has a fixed weekday header with abbreviated day names from Sunday through Saturday and a date grid below it. On the left side the week numbers are displayed for each row.
- **Day cell states** Hovering a day highlights the day number with a gray background. Selecting a day highlights the day number with a blue background. The current date is highlighted by default and remains blue when the user selects another date.

## Best for

- **Quarterly planning:** Choosing dates for quarterly milestones, reviews, or deadlines while keeping the full three-month period visible.
- **Annual planning:** Finding and selecting dates for yearly programs, renewal cycles, or recurring business activities with all 12 months available in one view.
- **Seasonal scheduling:** Selecting dates for campaigns, enrollment periods, or other activities organized around a particular quarter or season.
- **Long-range date selection:** Moving between an annual overview and a focused quarter view when the target date may be several months away.

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/angular/datepicker/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/angular/datepicker/api#opt-themeVariant) - option
- [`controls`](https://mobiscroll.com/docs/angular/datepicker/api#opt-controls) - option
- [`display`](https://mobiscroll.com/docs/angular/datepicker/api#opt-display) - option
- [`calendarSize`](https://mobiscroll.com/docs/angular/datepicker/api#opt-calendarSize) - option
- [`calendarType`](https://mobiscroll.com/docs/angular/datepicker/api#opt-calendarType) - option
- [`calendarHeaderTemplate`](https://mobiscroll.com/docs/angular/datepicker/api#template-calendarHeaderTemplate) - template
- [`refDate`](https://mobiscroll.com/docs/angular/datepicker/api#opt-refDate) - option
- [`showWeekNumbers`](https://mobiscroll.com/docs/angular/datepicker/api#opt-showWeekNumbers) - option
- [`onPageChange`](https://mobiscroll.com/docs/angular/datepicker/api#event-onPageChange) - event

## Code

### Component

```ts
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MbscModule, setOptions } from '@mobiscroll/angular';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  standalone: true,
  imports: [CommonModule, FormsModule, MbscModule],
})
export class AppComponent {
  viewType = 'q4';
  calType: 'year' | 'month' | 'week' = 'month';
  selectedDate = new Date();
  activeDate = new Date();

  changeView(): void {
    const year = this.activeDate.getFullYear();
    let date: Date;
    switch (this.viewType) {
      case 'q1':
        this.calType = 'month';
        date = new Date(year, 1, 1);
        break;
      case 'q2':
        this.calType = 'month';
        date = new Date(year, 4, 1);
        break;
      case 'q3':
        this.calType = 'month';
        date = new Date(year, 7, 1);
        break;
      case 'q4':
        this.calType = 'month';
        date = new Date(year, 10, 1);
        break;
      case 'year':
        this.calType = 'year';
        date = new Date(year, this.selectedDate.getMonth(), 1);
        break;
      default:
        this.calType = 'year';
        date = new Date(year, this.selectedDate.getMonth(), 1);
    }
    this.selectedDate = date;
    this.activeDate = date;
  }
  onPageChange(args: any): void {
    let type = '';
    if (this.calType === 'year') {
      type = 'year';
    } else {
      const month = args.firstDay.getMonth();
      if (month < 3) {
        type = 'q1';
      } else if (month < 6) {
        type = 'q2';
      } else if (month < 9) {
        type = 'q3';
      } else {
        type = 'q4';
      }
    }
    this.viewType = type;
    this.activeDate = args.firstDay;
  }
}
```

### Template

```html
<mbsc-datepicker
  [(ngModel)]="selectedDate"
  [controls]="['calendar']"
  display="inline"
  [calendarSize]="3"
  [calendarType]="calType"
  [calendarHeaderTemplate]="headerTemplate"
  refDate="1970-01-01"
  [showWeekNumbers]="true"
  (onPageChange)="onPageChange($event)"
>
  <ng-template #headerTemplate>
    <mbsc-calendar-nav></mbsc-calendar-nav>
    <div class="quarter-year-header-picker">
      <mbsc-segmented-group [(ngModel)]="viewType" (change)="changeView()">
        <mbsc-segmented value="q1">Q1</mbsc-segmented>
        <mbsc-segmented value="q2">Q2</mbsc-segmented>
        <mbsc-segmented value="q3">Q3</mbsc-segmented>
        <mbsc-segmented value="q4">Q4</mbsc-segmented>
        <mbsc-segmented value="year">Year</mbsc-segmented>
      </mbsc-segmented-group>
    </div>
    <mbsc-calendar-prev></mbsc-calendar-prev>
    <mbsc-calendar-next></mbsc-calendar-next>
  </ng-template>
</mbsc-datepicker>
```

### CSS

```css
.mbsc-datepicker .quarter-year-header-picker .mbsc-segmented {
  max-width: 280px;
  margin: 0 auto;
}

.quarter-year-header-picker {
  flex: 1 0 auto;
}
```

## Implementation notes

- Use `controls: ['calendar']`, `display: 'inline'`, and `calendarSize: 3` so the calendar always renders three months in a grid.
- **Quarter view**: `calendarType: 'month'` combined with `calendarSize: 3` renders the current quarter's three months in a multi-month grid.
- **Year view**: setting `calendarType` to `'year'` renders all 12 months of the year in one scrollable layout; `calendarSize` is left at `3` and has no effect in year mode.
- Set `refDate: '1970-01-01'` so the calendar's month grouping always aligns quarter boundaries to months 0/3/6/9, independent of the current date.
- Build a custom header with `renderCalendarHeader` (Angular: `calendarHeaderTemplate`, Vue: `#header` slot) containing `CalendarNav`/`mbsc-calendar-nav` and `CalendarPrev`/`CalendarNext` (`mbsc-calendar-prev`/`mbsc-calendar-next`); the React version additionally includes a `CalendarToday` button that the other frameworks' header markup omits.
- `calendarType` set to `'month'` renders the current quarter's months; set to `'year'` renders the year view. Navigating to a target month involves setting `calendarType` and calling `navigate(date)` to that month's first day (JS/jQuery: `instance.setOptions({ calendarType })` followed by `instance.navigate(date)`; React/Angular/Vue: update the bound `calendarType` state/binding together with the selected date/model).
- Use the `onPageChange` event (Angular: `(onPageChange)`, Vue: `@page-change`) to read `args.firstDay`/`event.firstDay` and determine which quarter or year is now visible.
- Pass `showWeekNumbers: true` to display the week-number column alongside each month grid.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-angular.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config angular
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   ng serve
   ```

On a trial, add `--trial` to the config command: `mobiscroll config angular --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/angular/getting-started/installation

## Related demos

- Previous: [Multiple Months](https://demo.mobiscroll.com/angular/calendar/multiple-months.md) - Show fixed or auto-fit months in the Angular date picker for travel, booking, and long-range date selection.
- Next: [Week & Month Views](https://demo.mobiscroll.com/angular/calendar/week-to-month.md) - Show week and month calendar views in the Angular date picker — add a header view switcher so users can toggle between layouts.
