Dynamic time

Dynamically transforms milliscond timestamps to a compact readable version. Unlike `fl-relative-time`, this uses relative time when the timestamp provided is less than two days ago, and uses a compact date format for timestamps more than two days ago or set in the future.
Milliseconds from now
Format
Sample Output
Milliseconds from now

Within the day (< 1 min)

Format

"Just now"

Sample Output

Just now

Milliseconds from now

Within the day (>= 1 min)

Format

x minutes / hours

Sample Output

2 hours

Milliseconds from now

A day ago

Format

"Yesterday"

Sample Output

Yesterday

Milliseconds from now

Within the week (< 7 days)

Format

Name of day (short)

Sample Output

Mon

Milliseconds from now

Exactly 1 week ago

Format

Month and day

Sample Output

Mar 12

Milliseconds from now

More than a week ago and within the current year

Format

Month and day

Sample Output

Mar 12

Milliseconds from now

Past the current year

Format

MMM d, y

Sample Output

Mar 12, 2020

Milliseconds from now

In the future

Format

MMM d, y

Sample Output

Mar 12, 3020

Transform
Arguments
millis : number
Return type
Promise<string>