Timezone Settings

The range works with local times by default, but ships with support for changing the timezone. The conversions and correct output relies on either of these three external libraries: luxon, moment-timezone and day.js. For installing and using these libraries check out this guide.

There are two angles regarding timezones:

  • dataTimezone - the range expects this format and returns this format. It is 'local' by default if the date-times don't contain any timezone information
  • displayTimezone - the calendar displays everything in this timezone. The date-times will be converted from the dataTimezone and displayed accordingly. It is 'local' by default

Invalids as well as marked, colored and labels date-times will all be interpreted in dataTimezone when they contain no timezone info and will be shown in displayTimezone on the calendar.

Get started with this example

Demo

Data timezone is

Display timezone is

The local timezone your browser is in:

html<mbsc-datepicker
    [controls]="['calendar', 'time']"
    select="range"
    dataTimezone="utc"
    displayTimezone="local"
    [timezonePlugin]="myDayjsTimezone"
    [(ngModel)]="mySelected"
></mbsc-datepicker>
tsimport { dayjsTimezone } from '@mobiscroll/angular';
import dayjs from 'dayjs';
import timezone from 'dayjs/plugin/timezone';
import utc from 'dayjs/plugin/utc';

// Extend Day.js with UTC and timezone plugins
dayjs.extend(utc);
dayjs.extend(timezone);
// Setup Mobiscroll Day.js plugin
dayjsTimezone.dayjs = dayjs;

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    myDayjsTimezone = dayjsTimezone;
    mySelected = null;
}

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.