@coin-voyage/shared 2.2.5-beta.6 → 2.2.5-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ export declare const en: {
9
9
  time: {
10
10
  soon: () => string;
11
11
  now: (long?: boolean) => string;
12
+ secondsAgo: (seconds: number, long?: boolean) => string;
12
13
  minutesAgo: (minutes: number, long?: boolean) => string;
13
14
  hoursAgo: (hours: number, long?: boolean) => string;
14
15
  daysAgo: (days: number, long?: boolean) => string;
@@ -12,6 +12,7 @@ export const en = {
12
12
  time: {
13
13
  soon: () => "soon",
14
14
  now: (long) => `${long ? "just now" : "now"}`,
15
+ secondsAgo: (seconds, long) => `${seconds}s ${long ? "ago" : ""}`,
15
16
  minutesAgo: (minutes, long) => `${minutes}m ${long ? "ago" : ""}`,
16
17
  hoursAgo: (hours, long) => `${hours}h ${long ? "ago" : ""}`,
17
18
  daysAgo: (days, long) => `${days}d ${long ? "ago" : ""}`,
@@ -16,9 +16,12 @@ export function timeAgo(sinceS, nowS, long) {
16
16
  nowS = now();
17
17
  }
18
18
  const seconds = Math.floor(nowS - sinceS);
19
- if (seconds < 60) {
19
+ if (seconds < 5) {
20
20
  return i18.now(long);
21
21
  }
22
+ if (seconds < 60) {
23
+ return i18.secondsAgo(seconds, long);
24
+ }
22
25
  const minutes = Math.floor(seconds / 60);
23
26
  if (minutes < 60) {
24
27
  return i18.minutesAgo(minutes, long);
@@ -28,7 +31,7 @@ export function timeAgo(sinceS, nowS, long) {
28
31
  return i18.hoursAgo(hours, long);
29
32
  }
30
33
  const days = Math.floor(hours / 24);
31
- return `${days}d${long ? " ago" : ""}`;
34
+ return i18.daysAgo(days, long);
32
35
  }
33
36
  /** Returns "soon", "1d", "2d", etc. Long form: "in 1d", "in 2d", ... */
34
37
  export function daysUntil(untilS, nowS, long) {
@@ -7,7 +7,7 @@ export interface Token {
7
7
  chainId: ChainId;
8
8
  logoURI: string;
9
9
  }
10
- interface ChainMetadata {
10
+ export interface ChainMetadata {
11
11
  chainId: ChainId;
12
12
  name: string;
13
13
  logoURI: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coin-voyage/shared",
3
3
  "description": "Shared utilities for Coin Voyage",
4
- "version": "2.2.5-beta.6",
4
+ "version": "2.2.5-beta.8",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {