ComponentsUtilities

Date

Dates in templates and code. The txDate pipe formats with Angular date patterns and shows - instead of an error for an empty or broken value; the calendar functions work on copies and count calendar days, so daylight saving time does not shift them.

Part of @tectra-ng/utils (npm install @tectra-ng/utils, also included in tectra-ng).

Features6APIThemingAccessibility

Basic

txDate takes a Date, an ISO string or a timestamp. Without a pattern it uses mediumDate; an empty or invalid value turns into -.

SO-2041 09.11.26 08:14Nov 10, 2026
SO-2042 10.11.26 12:02-
SO-2043 11.11.26 09:47-

Formats

Any Angular date pattern or named format works. TX_DATE_FORMATS holds the common ones as constants.

dd.MM.yy HH:mm → 11.11.26 09:05

Defaults

provideTxDateFormat sets the pattern, the empty text, the locale and the time zone for an app or a part of it — here for this example only.

Hosting 1 Mar 202528 Feb 2027
Support 15 Jun 2026Not set

Time zone

The second argument is a time zone offset: one moment, shown for several offices.

Kyiv +0200 Thu, 12 Nov 09:30
London UTC Thu, 12 Nov 07:30
New York -0500 Thu, 12 Nov 02:30
Tokyo +0900 Thu, 12 Nov 16:30

Date range

txDateRange turns the value of a range datepicker into { start, end } ISO strings for an API — null until both days are picked.

null

Calendar functions

Pure functions return a new Date and never change the one they get. Pick a day to see them work.

addDays(day, 1)Sun, 01.02.2026 15:20
addMonths(day, 1)Sat, 28.02.2026 15:20
startOfWeek(day)Mon, 26.01.2026 00:00
endOfDay(day)Sat, 31.01.2026 23:59
toIsoDay(day)2026-01-31
calendarDaysBetween(today, day)-284
isExpiringWithin(day)yes