design-zystem 1.0.410 → 1.0.411

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.
package/dist/index.d.mts CHANGED
@@ -1312,7 +1312,7 @@ declare const optimizeImage: (file: File | null | undefined, desiredBaseName: st
1312
1312
 
1313
1313
  declare const getRelativeTime: (date: Date | string) => string;
1314
1314
 
1315
- declare const getElapsedTime: (date: Date | string) => string;
1315
+ declare const getElapsedTime: (date: Date | string, language?: string) => string;
1316
1316
 
1317
1317
  declare const formatTime: (time: string | null | undefined) => string;
1318
1318
 
package/dist/index.d.ts CHANGED
@@ -1312,7 +1312,7 @@ declare const optimizeImage: (file: File | null | undefined, desiredBaseName: st
1312
1312
 
1313
1313
  declare const getRelativeTime: (date: Date | string) => string;
1314
1314
 
1315
- declare const getElapsedTime: (date: Date | string) => string;
1315
+ declare const getElapsedTime: (date: Date | string, language?: string) => string;
1316
1316
 
1317
1317
  declare const formatTime: (time: string | null | undefined) => string;
1318
1318
 
package/dist/index.js CHANGED
@@ -7115,23 +7115,29 @@ var getRelativeTime = (date) => {
7115
7115
 
7116
7116
  // src/utils/date/getElapsedTime.ts
7117
7117
  var UNITS2 = [
7118
- { name: "an", seconds: 31536e3, pluralize: true },
7119
- { name: "mois", seconds: 2592e3, pluralize: false },
7120
- { name: "semaine", seconds: 604800, pluralize: true },
7121
- { name: "jour", seconds: 86400, pluralize: true }
7118
+ { unit: "year", seconds: 31536e3 },
7119
+ { unit: "month", seconds: 2592e3 },
7120
+ { unit: "week", seconds: 604800 },
7121
+ { unit: "day", seconds: 86400 }
7122
7122
  ];
7123
- var getElapsedTime = (date) => {
7123
+ var getElapsedTime = (date, language = "fr") => {
7124
7124
  const elapsedSeconds = Math.floor(
7125
7125
  (Date.now() - new Date(date).getTime()) / 1e3
7126
7126
  );
7127
- for (const unit of UNITS2) {
7128
- const interval = Math.floor(elapsedSeconds / unit.seconds);
7127
+ for (const { unit, seconds } of UNITS2) {
7128
+ const interval = Math.floor(elapsedSeconds / seconds);
7129
7129
  if (interval >= 1) {
7130
- const suffix = unit.pluralize && interval > 1 ? "s" : "";
7131
- return `${interval} ${unit.name}${suffix}`;
7130
+ return new Intl.NumberFormat(language, {
7131
+ style: "unit",
7132
+ unit,
7133
+ unitDisplay: "long"
7134
+ }).format(interval);
7132
7135
  }
7133
7136
  }
7134
- return "aujourd'hui";
7137
+ return new Intl.RelativeTimeFormat(language, { numeric: "auto" }).format(
7138
+ 0,
7139
+ "day"
7140
+ );
7135
7141
  };
7136
7142
 
7137
7143
  // src/utils/date/formatTime.ts
package/dist/index.mjs CHANGED
@@ -6992,23 +6992,29 @@ var getRelativeTime = (date) => {
6992
6992
 
6993
6993
  // src/utils/date/getElapsedTime.ts
6994
6994
  var UNITS2 = [
6995
- { name: "an", seconds: 31536e3, pluralize: true },
6996
- { name: "mois", seconds: 2592e3, pluralize: false },
6997
- { name: "semaine", seconds: 604800, pluralize: true },
6998
- { name: "jour", seconds: 86400, pluralize: true }
6995
+ { unit: "year", seconds: 31536e3 },
6996
+ { unit: "month", seconds: 2592e3 },
6997
+ { unit: "week", seconds: 604800 },
6998
+ { unit: "day", seconds: 86400 }
6999
6999
  ];
7000
- var getElapsedTime = (date) => {
7000
+ var getElapsedTime = (date, language = "fr") => {
7001
7001
  const elapsedSeconds = Math.floor(
7002
7002
  (Date.now() - new Date(date).getTime()) / 1e3
7003
7003
  );
7004
- for (const unit of UNITS2) {
7005
- const interval = Math.floor(elapsedSeconds / unit.seconds);
7004
+ for (const { unit, seconds } of UNITS2) {
7005
+ const interval = Math.floor(elapsedSeconds / seconds);
7006
7006
  if (interval >= 1) {
7007
- const suffix = unit.pluralize && interval > 1 ? "s" : "";
7008
- return `${interval} ${unit.name}${suffix}`;
7007
+ return new Intl.NumberFormat(language, {
7008
+ style: "unit",
7009
+ unit,
7010
+ unitDisplay: "long"
7011
+ }).format(interval);
7009
7012
  }
7010
7013
  }
7011
- return "aujourd'hui";
7014
+ return new Intl.RelativeTimeFormat(language, { numeric: "auto" }).format(
7015
+ 0,
7016
+ "day"
7017
+ );
7012
7018
  };
7013
7019
 
7014
7020
  // src/utils/date/formatTime.ts
@@ -1778,7 +1778,7 @@ declare const formatName: (person?: {
1778
1778
 
1779
1779
  declare const getRelativeTime: (date: Date | string) => string;
1780
1780
 
1781
- declare const getElapsedTime: (date: Date | string) => string;
1781
+ declare const getElapsedTime: (date: Date | string, language?: string) => string;
1782
1782
 
1783
1783
  declare const formatTime: (time: string | null | undefined) => string;
1784
1784
 
@@ -1778,7 +1778,7 @@ declare const formatName: (person?: {
1778
1778
 
1779
1779
  declare const getRelativeTime: (date: Date | string) => string;
1780
1780
 
1781
- declare const getElapsedTime: (date: Date | string) => string;
1781
+ declare const getElapsedTime: (date: Date | string, language?: string) => string;
1782
1782
 
1783
1783
  declare const formatTime: (time: string | null | undefined) => string;
1784
1784
 
package/dist/ui/index.js CHANGED
@@ -8340,23 +8340,29 @@ var getRelativeTime = (date) => {
8340
8340
 
8341
8341
  // src/utils/date/getElapsedTime.ts
8342
8342
  var UNITS2 = [
8343
- { name: "an", seconds: 31536e3, pluralize: true },
8344
- { name: "mois", seconds: 2592e3, pluralize: false },
8345
- { name: "semaine", seconds: 604800, pluralize: true },
8346
- { name: "jour", seconds: 86400, pluralize: true }
8343
+ { unit: "year", seconds: 31536e3 },
8344
+ { unit: "month", seconds: 2592e3 },
8345
+ { unit: "week", seconds: 604800 },
8346
+ { unit: "day", seconds: 86400 }
8347
8347
  ];
8348
- var getElapsedTime = (date) => {
8348
+ var getElapsedTime = (date, language = "fr") => {
8349
8349
  const elapsedSeconds = Math.floor(
8350
8350
  (Date.now() - new Date(date).getTime()) / 1e3
8351
8351
  );
8352
- for (const unit of UNITS2) {
8353
- const interval = Math.floor(elapsedSeconds / unit.seconds);
8352
+ for (const { unit, seconds } of UNITS2) {
8353
+ const interval = Math.floor(elapsedSeconds / seconds);
8354
8354
  if (interval >= 1) {
8355
- const suffix = unit.pluralize && interval > 1 ? "s" : "";
8356
- return `${interval} ${unit.name}${suffix}`;
8355
+ return new Intl.NumberFormat(language, {
8356
+ style: "unit",
8357
+ unit,
8358
+ unitDisplay: "long"
8359
+ }).format(interval);
8357
8360
  }
8358
8361
  }
8359
- return "aujourd'hui";
8362
+ return new Intl.RelativeTimeFormat(language, { numeric: "auto" }).format(
8363
+ 0,
8364
+ "day"
8365
+ );
8360
8366
  };
8361
8367
 
8362
8368
  // src/utils/date/formatTime.ts
package/dist/ui/index.mjs CHANGED
@@ -8181,23 +8181,29 @@ var getRelativeTime = (date) => {
8181
8181
 
8182
8182
  // src/utils/date/getElapsedTime.ts
8183
8183
  var UNITS2 = [
8184
- { name: "an", seconds: 31536e3, pluralize: true },
8185
- { name: "mois", seconds: 2592e3, pluralize: false },
8186
- { name: "semaine", seconds: 604800, pluralize: true },
8187
- { name: "jour", seconds: 86400, pluralize: true }
8184
+ { unit: "year", seconds: 31536e3 },
8185
+ { unit: "month", seconds: 2592e3 },
8186
+ { unit: "week", seconds: 604800 },
8187
+ { unit: "day", seconds: 86400 }
8188
8188
  ];
8189
- var getElapsedTime = (date) => {
8189
+ var getElapsedTime = (date, language = "fr") => {
8190
8190
  const elapsedSeconds = Math.floor(
8191
8191
  (Date.now() - new Date(date).getTime()) / 1e3
8192
8192
  );
8193
- for (const unit of UNITS2) {
8194
- const interval = Math.floor(elapsedSeconds / unit.seconds);
8193
+ for (const { unit, seconds } of UNITS2) {
8194
+ const interval = Math.floor(elapsedSeconds / seconds);
8195
8195
  if (interval >= 1) {
8196
- const suffix = unit.pluralize && interval > 1 ? "s" : "";
8197
- return `${interval} ${unit.name}${suffix}`;
8196
+ return new Intl.NumberFormat(language, {
8197
+ style: "unit",
8198
+ unit,
8199
+ unitDisplay: "long"
8200
+ }).format(interval);
8198
8201
  }
8199
8202
  }
8200
- return "aujourd'hui";
8203
+ return new Intl.RelativeTimeFormat(language, { numeric: "auto" }).format(
8204
+ 0,
8205
+ "day"
8206
+ );
8201
8207
  };
8202
8208
 
8203
8209
  // src/utils/date/formatTime.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "design-zystem",
3
- "version": "1.0.410",
3
+ "version": "1.0.411",
4
4
  "description": "A React design system of importable components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",