ecotransac-shared-js 1.2.13 → 1.2.14

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.js CHANGED
@@ -417,8 +417,15 @@ var formatAddress = (address) => `${address.address}, ${address.postalCode} ${ad
417
417
  var formatSeconds = (seconds) => {
418
418
  const hours = Math.floor(seconds / 3600);
419
419
  const minutes = Math.floor((seconds - hours * 3600) / 60);
420
- if (hours === 0) return `${minutes} minute${minutes > 1 ? "s" : ""}`;
421
- return `${hours} heure${hours > 1 ? "s" : ""} et ${minutes} minute${minutes > 1 ? "s" : ""}`;
420
+ const secondsLeft = seconds - hours * 3600 - minutes * 60;
421
+ const hoursLabel = hours > 0 ? `${hours} heure${hours > 1 ? "s" : ""}` : null;
422
+ const minutesLabel = minutes > 0 ? `${minutes} minute${minutes > 1 ? "s" : ""}` : null;
423
+ const secondsLabel = secondsLeft > 0 ? `${secondsLeft} seconde${secondsLeft > 1 ? "s" : ""}` : null;
424
+ const labels = [hoursLabel, minutesLabel, secondsLabel].filter(Boolean);
425
+ if (labels.length > 1) {
426
+ labels.splice(-1, 0, "et");
427
+ }
428
+ return labels.join(" ");
422
429
  };
423
430
  var formatReference = (reference) => `R\xE9f. ${reference.toString().padStart(5, "0")}`;
424
431
  var formatDate = (date, withTime = false) => {
package/dist/index.mjs CHANGED
@@ -326,8 +326,15 @@ var formatAddress = (address) => `${address.address}, ${address.postalCode} ${ad
326
326
  var formatSeconds = (seconds) => {
327
327
  const hours = Math.floor(seconds / 3600);
328
328
  const minutes = Math.floor((seconds - hours * 3600) / 60);
329
- if (hours === 0) return `${minutes} minute${minutes > 1 ? "s" : ""}`;
330
- return `${hours} heure${hours > 1 ? "s" : ""} et ${minutes} minute${minutes > 1 ? "s" : ""}`;
329
+ const secondsLeft = seconds - hours * 3600 - minutes * 60;
330
+ const hoursLabel = hours > 0 ? `${hours} heure${hours > 1 ? "s" : ""}` : null;
331
+ const minutesLabel = minutes > 0 ? `${minutes} minute${minutes > 1 ? "s" : ""}` : null;
332
+ const secondsLabel = secondsLeft > 0 ? `${secondsLeft} seconde${secondsLeft > 1 ? "s" : ""}` : null;
333
+ const labels = [hoursLabel, minutesLabel, secondsLabel].filter(Boolean);
334
+ if (labels.length > 1) {
335
+ labels.splice(-1, 0, "et");
336
+ }
337
+ return labels.join(" ");
331
338
  };
332
339
  var formatReference = (reference) => `R\xE9f. ${reference.toString().padStart(5, "0")}`;
333
340
  var formatDate = (date, withTime = false) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecotransac-shared-js",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "modules": "dist/index.mjs",