Formatters
Class in @sascom/commonjs.
API catalogue · @sascom/commonjs · Class
TypeScript#
class FormattersCommonly used formatting methods. Explicitly not part of the public API
Members#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | |
| bytesToSize | Method | |
| formatAgo | Method | |
| formatBytes | Method | |
| formatCurrency | Method | |
| formatDatabaseDateTime | Method | |
| formatDate | Method | |
| formatDateTime | Method | |
| formatDateTimeShortest | Method | |
| formatDateTimeWithSeconds | Method | |
| formatDuration | Method | |
| formatMoney | Method | |
| formatSpan | Method | |
| formatTime | Method | |
| formatTimeObject | Method | |
| formatTimeSpan | Method | |
| GetHumanSize | Method | |
| parseDate | Method |
constructor#
TypeScript#
constructor()bytesToSize#
TypeScript#
public static bytesToSize(bytes: number): stringParameters#
| Name | Type | Description |
|---|---|---|
bytes |
number |
formatAgo#
TypeScript#
public static formatAgo(date: string | number | Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
string | number | Date |
formatBytes#
TypeScript#
public static formatBytes(bytes: number, decimals?: number): stringParameters#
| Name | Type | Description |
|---|---|---|
bytes |
number |
|
decimals |
number |
formatCurrency#
TypeScript#
public static formatCurrency(value: number): stringParameters#
| Name | Type | Description |
|---|---|---|
value |
number |
formatDatabaseDateTime#
TypeScript#
public static formatDatabaseDateTime(date: { epochMillis: number }): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
{ epochMillis: number } |
formatDate#
TypeScript#
public static formatDate(date: string | number | Date | null | undefined): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
string | number | Date | null | undefined |
formatDateTime#
TypeScript#
public static formatDateTime(date: string | number | Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
string | number | Date |
formatDateTimeShortest#
TypeScript#
public static formatDateTimeShortest(date: Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
Date |
formatDateTimeWithSeconds#
TypeScript#
public static formatDateTimeWithSeconds(date: string | number | Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
string | number | Date |
formatDuration#
TypeScript#
public static formatDuration(ms: number, showSeconds?: boolean, showMilliSeconds?: boolean): stringParameters#
| Name | Type | Description |
|---|---|---|
ms |
number |
|
showSeconds |
boolean |
|
showMilliSeconds |
boolean |
formatMoney#
TypeScript#
public static formatMoney(input: { amount: number; currency: string }): stringParameters#
| Name | Type | Description |
|---|---|---|
input |
{ amount: number; currency: string } |
formatSpan#
TypeScript#
public static formatSpan(date1: string | number | Date, date2: string | number | Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date1 |
string | number | Date |
|
date2 |
string | number | Date |
formatTime#
TypeScript#
public static formatTime(date: Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
Date |
formatTimeObject#
TypeScript#
public static formatTimeObject(date: Date): stringParameters#
| Name | Type | Description |
|---|---|---|
date |
Date |
formatTimeSpan#
TypeScript#
public static formatTimeSpan(ms: number | null | undefined, showSeconds?: boolean): stringParameters#
| Name | Type | Description |
|---|---|---|
ms |
number | null | undefined |
|
showSeconds |
boolean |
GetHumanSize#
TypeScript#
public static GetHumanSize(size: number): stringParameters#
| Name | Type | Description |
|---|---|---|
size |
number |
parseDate#
TypeScript#
public static parseDate(date: string | number | Date): DateParameters#
| Name | Type | Description |
|---|---|---|
date |
string | number | Date |