mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-09 15:45:01 -04:00
Minor corrections to phrasing/spelling.
This commit is contained in:
parent
3a63837d3d
commit
afbac084b6
4 changed files with 15 additions and 15 deletions
|
@ -19,20 +19,20 @@ function getHumanFriendlyDuration({ seconds }: { seconds: number }) {
|
|||
}
|
||||
|
||||
const timeUnits = [
|
||||
{ unit: 'millenium', secondsInUnit: 31536000000, format: prettifyExponentialNotation },
|
||||
{ unit: 'century', secondsInUnit: 3153600000 },
|
||||
{ unit: 'decade', secondsInUnit: 315360000 },
|
||||
{ unit: 'year', secondsInUnit: 31536000 },
|
||||
{ unit: 'month', secondsInUnit: 2592000 },
|
||||
{ unit: 'week', secondsInUnit: 604800 },
|
||||
{ unit: 'day', secondsInUnit: 86400 },
|
||||
{ unit: 'hour', secondsInUnit: 3600 },
|
||||
{ unit: 'minute', secondsInUnit: 60 },
|
||||
{ unit: 'second', secondsInUnit: 1 },
|
||||
{ unit: 'millenium', secondsInUnit: 31536000000, format: prettifyExponentialNotation, plural: 'millenia' },
|
||||
{ unit: 'century', secondsInUnit: 3153600000, plural: 'centuries' },
|
||||
{ unit: 'decade', secondsInUnit: 315360000, plural: 'decades' },
|
||||
{ unit: 'year', secondsInUnit: 31536000, plural: 'years' },
|
||||
{ unit: 'month', secondsInUnit: 2592000, plural: 'months' },
|
||||
{ unit: 'week', secondsInUnit: 604800, plural: 'weeks' },
|
||||
{ unit: 'day', secondsInUnit: 86400, plural: 'days' },
|
||||
{ unit: 'hour', secondsInUnit: 3600, plural: 'hours' },
|
||||
{ unit: 'minute', secondsInUnit: 60, plural: 'minutes' },
|
||||
{ unit: 'second', secondsInUnit: 1, plural: 'seconds' },
|
||||
];
|
||||
|
||||
return _.chain(timeUnits)
|
||||
.map(({ unit, secondsInUnit, format = _.identity }) => {
|
||||
.map(({ unit, secondsInUnit, plural, format = _.identity }) => {
|
||||
const quantity = Math.floor(seconds / secondsInUnit);
|
||||
seconds %= secondsInUnit;
|
||||
|
||||
|
@ -41,7 +41,7 @@ function getHumanFriendlyDuration({ seconds }: { seconds: number }) {
|
|||
}
|
||||
|
||||
const formattedQuantity = format(quantity);
|
||||
return `${formattedQuantity} ${unit}${quantity > 1 ? 's' : ''}`;
|
||||
return `${formattedQuantity} ${quantity > 1 ? plural : unit}`;
|
||||
})
|
||||
.compact()
|
||||
.take(2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue