(posNegDuration, withoutSuffix, thresholds, locale)
| 5397 | } |
| 5398 | |
| 5399 | function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { |
| 5400 | var duration = createDuration(posNegDuration).abs(), |
| 5401 | seconds = round(duration.as('s')), |
| 5402 | minutes = round(duration.as('m')), |
| 5403 | hours = round(duration.as('h')), |
| 5404 | days = round(duration.as('d')), |
| 5405 | months = round(duration.as('M')), |
| 5406 | weeks = round(duration.as('w')), |
| 5407 | years = round(duration.as('y')), |
| 5408 | a = |
| 5409 | (seconds <= thresholds.ss && ['s', seconds]) || |
| 5410 | (seconds < thresholds.s && ['ss', seconds]) || |
| 5411 | (minutes <= 1 && ['m']) || |
| 5412 | (minutes < thresholds.m && ['mm', minutes]) || |
| 5413 | (hours <= 1 && ['h']) || |
| 5414 | (hours < thresholds.h && ['hh', hours]) || |
| 5415 | (days <= 1 && ['d']) || |
| 5416 | (days < thresholds.d && ['dd', days]); |
| 5417 | |
| 5418 | if (thresholds.w != null) { |
| 5419 | a = |
| 5420 | a || |
| 5421 | (weeks <= 1 && ['w']) || |
| 5422 | (weeks < thresholds.w && ['ww', weeks]); |
| 5423 | } |
| 5424 | a = a || |
| 5425 | (months <= 1 && ['M']) || |
| 5426 | (months < thresholds.M && ['MM', months]) || |
| 5427 | (years <= 1 && ['y']) || ['yy', years]; |
| 5428 | |
| 5429 | a[2] = withoutSuffix; |
| 5430 | a[3] = +posNegDuration > 0; |
| 5431 | a[4] = locale; |
| 5432 | return substituteTimeAgo.apply(null, a); |
| 5433 | } |
| 5434 | |
| 5435 | // This function allows you to set the rounding function for relative time strings |
| 5436 | function getSetRelativeTimeRounding(roundingFunction) { |
no test coverage detected