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

# Quarter and Year View - Vue Calendar demo

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

- [Live demo](https://demo.mobiscroll.com/vue/calendar/quarter-year-view)
- [View SFC JS code on GitHub](https://github.com/acidb/mobiscroll-demos-vue/tree/main/src/demos/datepicker/calendar/quarter-year-view)
- [View SFC TS code on GitHub](https://github.com/acidb/mobiscroll-demos-vue-ts/tree/main/src/demos/datepicker/calendar/quarter-year-view)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/javascript/calendar/quarter-year-view.md), [jQuery](https://demo.mobiscroll.com/jquery/calendar/quarter-year-view.md), [Angular](https://demo.mobiscroll.com/angular/calendar/quarter-year-view.md), [React](https://demo.mobiscroll.com/react/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/vue/calendar/dots-colors-labels) to days along with [week counters](https://demo.mobiscroll.com/vue/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/vue/datepicker/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/vue/datepicker/api#opt-themeVariant) - option
- [`display`](https://mobiscroll.com/docs/vue/datepicker/api#opt-display) - option
- [`controls`](https://mobiscroll.com/docs/vue/datepicker/api#opt-controls) - option
- [`calendarSize`](https://mobiscroll.com/docs/vue/datepicker/api#opt-calendarSize) - option
- [`calendarType`](https://mobiscroll.com/docs/vue/datepicker/api#opt-calendarType) - option
- [`refDate`](https://mobiscroll.com/docs/vue/datepicker/api#opt-refDate) - option
- [`showWeekNumbers`](https://mobiscroll.com/docs/vue/datepicker/api#opt-showWeekNumbers) - option
- [`page-change`](https://mobiscroll.com/docs/vue/datepicker/api#event-onPageChange) - event

## Code

### SFC JS

```vue
<script setup>
import {
  MbscCalendarNav,
  MbscCalendarNext,
  MbscCalendarPrev,
  MbscDatepicker,
  MbscSegmented,
  MbscSegmentedGroup,
  setOptions
} from '@mobiscroll/vue'
import { ref } from 'vue'

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

const viewType = ref('q4')
const calType = ref('month')
const selectedDate = ref(new Date())
const activeDate = ref(new Date())

function changeView() {
  const year = activeDate.value.getFullYear()
  let date
  switch (viewType.value) {
    case 'q1':
      calType.value = 'month'
      date = new Date(year, 1, 1)
      break
    case 'q2':
      calType.value = 'month'
      date = new Date(year, 4, 1)
      break
    case 'q3':
      calType.value = 'month'
      date = new Date(year, 7, 1)
      break
    case 'q4':
      calType.value = 'month'
      date = new Date(year, 10, 1)
      break
    case 'year':
      calType.value = 'year'
      date = new Date(year, selectedDate.value.getMonth(), 1)
      break
  }
  selectedDate.value = date
  activeDate.value = date
}

function handlePageChange(args) {
  let type = ''
  if (calType.value === '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'
    }
  }
  viewType.value = type
  activeDate.value = args.firstDay
}
</script>

<template>
  <MbscDatepicker
    v-model="selectedDate"
    display="inline"
    :controls="['calendar']"
    :calendarSize="3"
    :calendarType="calType"
    refDate="1970-01-01"
    :showWeekNumbers="true"
    @page-change="handlePageChange"
  >
    <template #header>
      <MbscCalendarNav />
      <div class="quarter-year-header-picker">
        <MbscSegmentedGroup v-model="viewType" @change="changeView">
          <MbscSegmented value="q1">Q1</MbscSegmented>
          <MbscSegmented value="q2">Q2</MbscSegmented>
          <MbscSegmented value="q3">Q3</MbscSegmented>
          <MbscSegmented value="q4">Q4</MbscSegmented>
          <MbscSegmented value="year">Year</MbscSegmented>
        </MbscSegmentedGroup>
      </div>
      <MbscCalendarPrev />
      <MbscCalendarNext />
    </template>
  </MbscDatepicker>
</template>

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

.quarter-year-header-picker {
  flex: 1 0 auto;
}
</style>
```

### SFC TS

```vue
<script setup lang="ts">
import {
  MbscCalendarNav,
  MbscCalendarNext,
  MbscCalendarPrev,
  MbscDatepicker,
  MbscSegmented,
  MbscSegmentedGroup,
  setOptions
} from '@mobiscroll/vue'
import { ref } from 'vue'

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

const viewType = ref<string>('q4')
const calType = ref<any>('month')
const selectedDate = ref<any>(new Date())
const activeDate = ref<any>(new Date())

function changeView() {
  const year = activeDate.value.getFullYear()
  let date: any
  switch (viewType.value) {
    case 'q1':
      calType.value = 'month'
      date = new Date(year, 1, 1)
      break
    case 'q2':
      calType.value = 'month'
      date = new Date(year, 4, 1)
      break
    case 'q3':
      calType.value = 'month'
      date = new Date(year, 7, 1)
      break
    case 'q4':
      calType.value = 'month'
      date = new Date(year, 10, 1)
      break
    case 'year':
      calType.value = 'year'
      date = new Date(year, selectedDate.value.getMonth(), 1)
      break
  }
  selectedDate.value = date
  activeDate.value = date
}

function handlePageChange(args: any) {
  let type = ''
  if (calType.value === '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'
    }
  }
  viewType.value = type
  activeDate.value = args.firstDay
}
</script>

<template>
  <MbscDatepicker
    v-model="selectedDate"
    display="inline"
    :controls="['calendar']"
    :calendarSize="3"
    :calendarType="calType"
    refDate="1970-01-01"
    :showWeekNumbers="true"
    @page-change="handlePageChange"
  >
    <template #header>
      <MbscCalendarNav />
      <div class="quarter-year-header-picker">
        <MbscSegmentedGroup v-model="viewType" @change="changeView">
          <MbscSegmented value="q1">Q1</MbscSegmented>
          <MbscSegmented value="q2">Q2</MbscSegmented>
          <MbscSegmented value="q3">Q3</MbscSegmented>
          <MbscSegmented value="q4">Q4</MbscSegmented>
          <MbscSegmented value="year">Year</MbscSegmented>
        </MbscSegmentedGroup>
      </div>
      <MbscCalendarPrev />
      <MbscCalendarNext />
    </template>
  </MbscDatepicker>
</template>

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

.quarter-year-header-picker {
  flex: 1 0 auto;
}
</style>
```

## 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-vue.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 vue
   ```

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

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

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

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

## Related demos

- Previous: [Multiple Months](https://demo.mobiscroll.com/vue/calendar/multiple-months.md) - Show fixed or auto-fit months in a Vue calendar date picker — switch between month and week view.
- Next: [Week & Month Views](https://demo.mobiscroll.com/vue/calendar/week-to-month.md) - Show week and month calendar view in a Vue date picker — add a header view switcher so users can toggle between layouts.
