func description

This commit is contained in:
Bernt Christian Egeland 2023-01-15 14:07:41 +01:00
parent c5b2b0ef24
commit bb0b68f5cc

View File

@ -16,6 +16,15 @@ export const getNowYesterdayInLong = (): number => {
return dateToLong(getNowYesterday()); return dateToLong(getNowYesterday());
}; };
/**
* This function takes in a unix timestamp, locale, timezone,
* and returns a dateTime string.
* If unixTimestamp is not provided, it returns 'Invalid time'
* @param unixTimestamp: number
* @param locale: string
* @param timezone: string
* @returns string - dateTime or 'Invalid time' if unixTimestamp is not provided
*/
export const formatUnixTimestampToDateTime = (unixTimestamp: number, locale: string, timezone: string): string => { export const formatUnixTimestampToDateTime = (unixTimestamp: number, locale: string, timezone: string): string => {
if (isNaN(unixTimestamp)) { if (isNaN(unixTimestamp)) {
return 'Invalid time'; return 'Invalid time';