Class: FormatDateService
@flyze/lib-core-angular 1.0.0-alpha.34· latestDefined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:22
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FormatDateService(
translocoService):FormatDateService
Defined in: projects/lib-core-angular/src/lib/modules/format-date/format-date.service.ts:23
Parameters
Section titled “Parameters”translocoService
Section titled “translocoService”TranslocoService
Returns
Section titled “Returns”FormatDateService
Methods
Section titled “Methods”getDateTimeByCurrentLanguage()
Section titled “getDateTimeByCurrentLanguage()”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.
Parameters
Section titled “Parameters”Date
The date to be formatted
format?
Section titled “format?”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'.
timeZone?
Section titled “timeZone?”"-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.
Returns
Section titled “Returns”string
The formatted date string
getDateTimeByCurrentLanguage$()
Section titled “getDateTimeByCurrentLanguage$()”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.
Parameters
Section titled “Parameters”Date
The date to be formatted
format?
Section titled “format?”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'.
timeZone?
Section titled “timeZone?”"-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.
Returns
Section titled “Returns”Observable<string>
An observable that emits a formatted date string according to the given format and the active language of the TranslocoService.
getDateTimeByFormat()
Section titled “getDateTimeByFormat()”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
Parameters
Section titled “Parameters”Date
The date to be formatted
format
Section titled “format”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
locale?
Section titled “locale?”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.
timeZone?
Section titled “timeZone?”"-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
Returns
Section titled “Returns”string
The formatted date string