PipeUpdated in v15Optional

wrDate

Format a date with a named preset or a token string.

Installation

Import the class. This entry point has no stylesheet.

import { Component } from '@angular/core';
import { WrDate } from 'ngwr/pipes';

@Component({ imports: [WrDate] })
export class MyComponent {}

Named keys

Six presets that follow the app locale. With no argument, shortDate.

{{ now | wrDate }}                    <!-- shortDate (default) -->
{{ now | wrDate: 'mediumDate' }}      <!-- Jun 12, 2026        -->
{{ now | wrDate: 'time' }}            <!-- 10:51 AM            -->
{{ now | wrDate: 'mediumDateTime' }}  <!-- Jun 12, 2026, 10:51 AM -->
shortDate10/28/2026
mediumDateOct 28, 2026
longDateOctober 28, 2026
time09:18 AM
shortDateTime10/28/2026, 09:18 AM
mediumDateTimeOct 28, 2026, 09:18 AM

Seconds and hour cycle

time and shortDateTime take a 12h or 24h suffix to pin the clock, then Seconds to add seconds. New in v15.

{{ now | wrDate: 'time24h' }}               <!-- 10:51     -->
{{ now | wrDate: 'time12hSeconds' }}        <!-- 10:51:07 AM -->
{{ now | wrDate: 'shortDateTimeSeconds' }}  <!-- 6/12/2026, 10:51:07 AM -->
time12h09:18 AM
time24h09:18
timeSeconds09:18:16 AM
time12hSeconds09:18:16 AM
time24hSeconds09:18:16
shortDateTime12h10/28/2026, 09:18 AM
shortDateTime24h10/28/2026, 09:18
shortDateTimeSeconds10/28/2026, 09:18:16 AM
shortDateTime12hSeconds10/28/2026, 09:18:16 AM
shortDateTime24hSeconds10/28/2026, 09:18:16

Token strings

Tokens: yyyy yy MMMM MMM MM M dd d HH H hh h mm ss a, plus 'quoted' text. There is no weekday token.

{{ now | wrDate: 'dd.MM.yyyy' }}  <!-- 12.06.2026   -->
{{ now | wrDate: 'd MMMM yyyy' }} <!-- 12 June 2026 -->
28.10.2026 · 28 October 2026 · 09:18:16

Playground

Oct 28, 2026, 09:18 AM

{{ now | wrDate: 'mediumDateTime' }}

Customize

Format

API

NameDescriptionTypeDefault
wrDateFormats through WrDateAdapter: the native one, or your own.(value: Date | string | number | null | undefined, format: WrDateFormat | string = 'shortDate') => string—

See also