shelving 1.175.2 → 1.175.3
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/package.json +1 -1
- package/util/duration.d.ts +1 -1
- package/util/duration.js +9 -7
package/package.json
CHANGED
package/util/duration.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export declare function isToday(target: PossibleDate, current?: PossibleDate, ca
|
|
|
111
111
|
* - Makes a sensible choice about the best time unit to use.
|
|
112
112
|
* - Years will be used for anything 18 months or more, e.g. `in 2 years`
|
|
113
113
|
* - Months will be used for anything 10 weeks or more, e.g. `in 14 months`
|
|
114
|
-
* - Weeks will be used for anything
|
|
114
|
+
* - Weeks will be used for anything 10 days or more, e.g. `in 9 weeks`
|
|
115
115
|
* - Days will be used for anything 1 day or more, e.g. `in 13 days`
|
|
116
116
|
* - Hours will be used for anything 1 hour or more, e.g. `in 23 hours`
|
|
117
117
|
* - Minutes will be used for anything 1 minute or more, e.g. `1 minute ago` or `in 59 minutes`
|
package/util/duration.js
CHANGED
|
@@ -155,7 +155,7 @@ export function isToday(target, current, caller = isToday) {
|
|
|
155
155
|
* - Makes a sensible choice about the best time unit to use.
|
|
156
156
|
* - Years will be used for anything 18 months or more, e.g. `in 2 years`
|
|
157
157
|
* - Months will be used for anything 10 weeks or more, e.g. `in 14 months`
|
|
158
|
-
* - Weeks will be used for anything
|
|
158
|
+
* - Weeks will be used for anything 10 days or more, e.g. `in 9 weeks`
|
|
159
159
|
* - Days will be used for anything 1 day or more, e.g. `in 13 days`
|
|
160
160
|
* - Hours will be used for anything 1 hour or more, e.g. `in 23 hours`
|
|
161
161
|
* - Minutes will be used for anything 1 minute or more, e.g. `1 minute ago` or `in 59 minutes`
|
|
@@ -163,17 +163,19 @@ export function isToday(target, current, caller = isToday) {
|
|
|
163
163
|
*/
|
|
164
164
|
export function getBestTimeUnit(ms) {
|
|
165
165
|
const abs = Math.abs(ms);
|
|
166
|
-
if (abs
|
|
166
|
+
if (abs >= 18 * MONTH)
|
|
167
167
|
return TIME_UNITS.require("year");
|
|
168
|
-
if (abs
|
|
168
|
+
if (abs >= 10 * WEEK)
|
|
169
169
|
return TIME_UNITS.require("month");
|
|
170
|
-
if (abs
|
|
170
|
+
if (abs >= 10 * DAY)
|
|
171
|
+
return TIME_UNITS.require("week");
|
|
172
|
+
if (abs >= DAY)
|
|
171
173
|
return TIME_UNITS.require("day");
|
|
172
|
-
if (abs
|
|
174
|
+
if (abs >= HOUR)
|
|
173
175
|
return TIME_UNITS.require("hour");
|
|
174
|
-
if (abs
|
|
176
|
+
if (abs >= MINUTE)
|
|
175
177
|
return TIME_UNITS.require("minute");
|
|
176
|
-
if (abs
|
|
178
|
+
if (abs >= SECOND)
|
|
177
179
|
return TIME_UNITS.require("second");
|
|
178
180
|
return TIME_UNITS.require("millisecond");
|
|
179
181
|
}
|