Skip to content

Class: FormatDateService

@flyze/lib-core-angular 1.0.0-alpha.34· latest

Defined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:22

new FormatDateService(translocoService): FormatDateService

Defined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:23

TranslocoService

FormatDateService

getDateTimeByCurrentLanguage(date, format?, timeZone?): string

Defined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:62

Returns a formatted date string according to the given format and the active language of the TranslocoService.

Date

The date to be formatted

string & object | "short" | "medium" | "long" | "full" | "shortDate" | "mediumDate" | "longDate" | "fullDate" | "shortTime" | "mediumTime" | "longTime" | "fullTime"

The format to be used for formatting the date. Defaults to 'fullDate'.

"-1200" | "-1100" | "-1000" | "-0930" | "-0900" | "-0800" | "-0700" | "-0600" | "-0500" | "-0430" | "-0400" | "-0330" | "-0300" | "-0200" | "-0100" | "+0000" | "+0100" | "+0200" | "+0300" | "+0330" | "+0400" | "+0430" | "+0500" | "+0530" | "+0545" | "+0600" | "+0630" | "+0700" | "+0800" | "+0845" | "+0900" | "+0930" | "+1000" | "+1030" | "+1100" | "+1200" | "+1245" | "+1300" | "+1400"

The time zone offset to be used for formatting the date.

string

The formatted date string


getDateTimeByCurrentLanguage$(date, format?, timeZone?): Observable<string>

Defined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:77

Returns an observable that emits a formatted date string according to the given format and the active language of the TranslocoService.

Date

The date to be formatted

string & object | "short" | "medium" | "long" | "full" | "shortDate" | "mediumDate" | "longDate" | "fullDate" | "shortTime" | "mediumTime" | "longTime" | "fullTime"

The format to be used for formatting the date. Defaults to 'fullDate'.

"-1200" | "-1100" | "-1000" | "-0930" | "-0900" | "-0800" | "-0700" | "-0600" | "-0500" | "-0430" | "-0400" | "-0330" | "-0300" | "-0200" | "-0100" | "+0000" | "+0100" | "+0200" | "+0300" | "+0330" | "+0400" | "+0430" | "+0500" | "+0530" | "+0545" | "+0600" | "+0630" | "+0700" | "+0800" | "+0845" | "+0900" | "+0930" | "+1000" | "+1030" | "+1100" | "+1200" | "+1245" | "+1300" | "+1400"

The time zone offset to be used for formatting the date.

Observable<string>

An observable that emits a formatted date string according to the given format and the active language of the TranslocoService.


getDateTimeByFormat(date, format, locale?, timeZone?): string

Defined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:46

Formats a date according to the given format and locale

Date

The date to be formatted

string & object | "short" | "medium" | "long" | "full" | "shortDate" | "mediumDate" | "longDate" | "fullDate" | "shortTime" | "mediumTime" | "longTime" | "fullTime"

The format to be used for formatting the date. Use Intellisense to browse through the available options

You are also able to provide your own custom date format string, e.g. 'dd.MM.yyyyy' or 'yyyy-MM-dd HH:mm:ss.SSS'

For more info, please visit Custom Format Options

string & object | "de" | "en"

The locale to be used for formatting the date. If not provided, the active language of the TranslocoService will be used.

"-1200" | "-1100" | "-1000" | "-0930" | "-0900" | "-0800" | "-0700" | "-0600" | "-0500" | "-0430" | "-0400" | "-0330" | "-0300" | "-0200" | "-0100" | "+0000" | "+0100" | "+0200" | "+0300" | "+0330" | "+0400" | "+0430" | "+0500" | "+0530" | "+0545" | "+0600" | "+0630" | "+0700" | "+0800" | "+0845" | "+0900" | "+0930" | "+1000" | "+1030" | "+1100" | "+1200" | "+1245" | "+1300" | "+1400"

The time zone offset to be used for formatting the date

string

The formatted date string