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

# Quarter and Year View - jQuery Calendar demo

A JQuery 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/jquery/calendar/quarter-year-view)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-jquery/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), [Angular](https://demo.mobiscroll.com/angular/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/jquery/calendar/dots-colors-labels) to days along with [week counters](https://demo.mobiscroll.com/jquery/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/jquery/datepicker/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-themeVariant) - option
- [`controls`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-controls) - option
- [`display`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-display) - option
- [`calendarType`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-calendarType) - option
- [`calendarSize`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-calendarSize) - option
- [`refDate`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-refDate) - option
- [`showWeekNumbers`](https://mobiscroll.com/docs/jquery/datepicker/api#opt-showWeekNumbers) - option
- [`renderCalendarHeader`](https://mobiscroll.com/docs/jquery/datepicker/api#renderer-renderCalendarHeader) - renderer
- [`onPageChange`](https://mobiscroll.com/docs/jquery/datepicker/api#event-onPageChange) - event
- [`setOptions`](https://mobiscroll.com/docs/jquery/datepicker/api#method-setOptions) - method
- [`navigate`](https://mobiscroll.com/docs/jquery/datepicker/api#method-navigate) - method

## Code

### JS

```js
mobiscroll.setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

$(function () {
  var selectedDate = new Date();
  var myCalendar = $('#demo-quarter-year-view')
    .mobiscroll()
    .datepicker({
      controls: ['calendar'],
      display: 'inline',
      calendarType: 'month',
      calendarSize: 3,
      refDate: '1970-01-01',
      showWeekNumbers: true,
      renderCalendarHeader: function () {
        return (
          '<div mbsc-calendar-nav></div>' +
          '<div class="quarter-year-header-picker">' +
          '<label><input mbsc-segmented type="radio" name="view" value="q1" class="md-quarter-year-view-change">Q1</label>' +
          '<label><input mbsc-segmented type="radio" name="view" value="q2" class="md-quarter-year-view-change">Q2</label>' +
          '<label><input mbsc-segmented type="radio" name="view" value="q3" class="md-quarter-year-view-change">Q3</label>' +
          '<label><input mbsc-segmented type="radio" name="view" value="q4" class="md-quarter-year-view-change">Q4</label>' +
          '<label><input mbsc-segmented typce="radio" name="view" value="year" class="md-quarter-year-view-change">Year</label></div>' +
          '<div mbsc-calendar-prev></div>' +
          '<div mbsc-calendar-next></div>'
        );
      },
      onPageChange: function (args) {
        selectedDate = args.firstDay;
        setType($('.md-quarter-year-view-change[value="year"]').mobiscroll('getInst').checked);
      },
    })
    .mobiscroll('getInst');

  function setType(yearView) {
    var type = '';
    if (yearView) {
      type = 'year';
    } else {
      var month = selectedDate.getMonth();
      if (month < 3) {
        type = 'q1';
      } else if (month < 6) {
        type = 'q2';
      } else if (month < 9) {
        type = 'q3';
      } else {
        type = 'q4';
      }
    }

    $('.md-quarter-year-view-change[value=' + type + ']').mobiscroll('getInst').checked = true;
  }

  setTimeout(function () {
    $('.md-quarter-year-view-change').on('change', function (ev) {
      var year = selectedDate.getFullYear();
      var type;
      var date;

      switch (ev.target.value) {
        case 'q1':
          type = 'month';
          date = new Date(year, 0, 1);
          break;
        case 'q2':
          type = 'month';
          date = new Date(year, 3, 1);
          break;
        case 'q3':
          type = 'month';
          date = new Date(year, 6, 1);
          break;
        case 'q4':
          type = 'month';
          date = new Date(year, 9, 1);
          break;
        case 'year':
          type = 'year';
          date = new Date(year, selectedDate.getMonth(), 1);
          break;
      }
      myCalendar.setOptions({ calendarType: type });
      myCalendar.navigate(date);
    });
    setType();
  }, 1000);
});
```

### HTML

```html
<div id="demo-quarter-year-view"></div>
```

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

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 jquery --trial`.

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

## Related demos

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