Skip to content

Commit cce8136

Browse files
committed
Исправление для опозданий в несколько секунд
1 parent 71f432d commit cce8136

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

hwproj.front/src/services/Utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ export default class Utils {
2727

2828
if (diffHoursInt === 0) {
2929
const diffMinutes = Math.trunc(milliseconds / (1000 * 60))
30-
return diffMinutes + " " + this.pluralizeHelper(["минуту", "минуты", "минут"], diffMinutes)
30+
if (diffMinutes > 0) {
31+
return diffMinutes + " " + this.pluralizeHelper(["минуту", "минуты", "минут"], diffMinutes)
32+
}
33+
const diffSeconds = Math.trunc(milliseconds / 1000)
34+
return diffSeconds + " " + this.pluralizeHelper(["секунду", "секунды", "секунд"], diffSeconds)
3135
}
3236

3337
const diffDays = Math.trunc(diffHours / 24)
@@ -70,7 +74,7 @@ export default class Utils {
7074
month: 'long',
7175
day: 'numeric',
7276
};
73-
77+
7478
return (new Date(date)).toLocaleString(undefined, options)
7579
}
7680

0 commit comments

Comments
 (0)