mirror of
https://github.com/benjamin-wilson/public-pool-ui.git
synced 2025-08-08 20:21:47 +02:00
more precision
This commit is contained in:
@@ -22,12 +22,14 @@ export class DateAgoPipe implements PipeTransform {
|
|||||||
};
|
};
|
||||||
let counter;
|
let counter;
|
||||||
for (const i in intervals) {
|
for (const i in intervals) {
|
||||||
|
const number = (seconds / intervals[i]).toFixed(1);
|
||||||
counter = Math.floor(seconds / intervals[i]);
|
counter = Math.floor(seconds / intervals[i]);
|
||||||
|
|
||||||
if (counter > 0)
|
if (counter > 0)
|
||||||
if (counter === 1) {
|
if (counter === 1) {
|
||||||
return counter + ' ' + i + ''; // singular (1 day ago)
|
return number + ' ' + i + ''; // singular (1 day ago)
|
||||||
} else {
|
} else {
|
||||||
return counter + ' ' + i + 's'; // plural (2 days ago)
|
return number + ' ' + i + 's'; // plural (2 days ago)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user