Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

DATE_PIPE_DEFAULT_TIMEZONE is deprecated. To set a default timezone for Angular’s DatePipe, provide DATE_PIPE_DEFAULT_OPTIONS with a timezone field. If you do not configure a timezone, DatePipe uses the end user’s local system timezone. A timezone passed to an individual pipe expression overrides the configured default.

Replace DATE_PIPE_DEFAULT_TIMEZONE with DATE_PIPE_DEFAULT_OPTIONS

Angular’s API marks DATE_PIPE_DEFAULT_TIMEZONE as deprecated and recommends the DATE_PIPE_DEFAULT_OPTIONS token to configure DatePipe. The options token accepts a DatePipeConfig object, which can include a timezone and a dateFormat.

import { DATE_PIPE_DEFAULT_OPTIONS } from '@angular/common';

providers: [
  {
    provide: DATE_PIPE_DEFAULT_OPTIONS,
    useValue: { timezone: '+0430' },
  },
]

The offset +0430 is the timezone example in Angular’s API documentation. The example does not establish support for every named IANA timezone.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

See Angular’s deprecated token documentation and the DATE_PIPE_DEFAULT_OPTIONS API for the current configuration details.

Set a timezone for one template expression

To format a particular value in a different timezone, pass the timezone as the second argument after the format string:

{{ scheduledOn | date: 'hh:mm' : 'UTC' }}

Angular documents UTC in its template pipes guide. An explicit timezone argument on a pipe expression takes precedence over the application-level default.

Configuration Scope Precedence
DATE_PIPE_DEFAULT_OPTIONS with timezone Default for DatePipe expressions that do not specify a timezone Overridden by an explicit timezone argument
Timezone argument in a DatePipe expression That expression Overrides the configured default

What DatePipe uses when no timezone is set

If neither the configuration nor the pipe expression provides a timezone, DatePipe uses the end user’s local system timezone. Consequently, the same date value can display at different local times in different runtime environments. Angular’s default-options API documents this fallback.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Inputs, locale formatting, and change detection

Accepted date values

DatePipe accepts a JavaScript Date, milliseconds since the UTC epoch, or an ISO string. It formats the value according to locale rules. Angular includes only en-US locale data by default; import data for another locale when your application needs it.

Changing a Date value

DatePipe is pure: changing the contents of an existing Date object does not cause the pipe to run again. When the date changes, pass a new Date object reference. The DatePipe API documents its input types, locale behavior, timezone precedence, and pure-pipe behavior.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.