shelving 1.175.1 → 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 CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.175.1",
14
+ "version": "1.175.3",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/dhoulb/shelving.git"
@@ -111,10 +111,10 @@ 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 2 weeks or more, e.g. `in 9 weeks`
115
- * - Days will be used for anything 24 hours or more, e.g. `in 13 days`
116
- * - Hours will be used for anything 90 minutes or more, e.g. `in 23 hours`
117
- * - Minutes will be used for anything 1 second or more, e.g. `1 minute ago` or `in 59 minutes`
114
+ * - Weeks will be used for anything 10 days or more, e.g. `in 9 weeks`
115
+ * - Days will be used for anything 1 day or more, e.g. `in 13 days`
116
+ * - Hours will be used for anything 1 hour or more, e.g. `in 23 hours`
117
+ * - Minutes will be used for anything 1 minute or more, e.g. `1 minute ago` or `in 59 minutes`
118
118
  * - Seconds will be used for anything 1000 milliseconds or more, e.g. `in 59 seconds`
119
119
  */
120
120
  export declare function getBestTimeUnit(ms: number): Unit<TimeUnitKey>;
package/util/duration.js CHANGED
@@ -155,25 +155,27 @@ 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 2 weeks or more, e.g. `in 9 weeks`
159
- * - Days will be used for anything 24 hours or more, e.g. `in 13 days`
160
- * - Hours will be used for anything 90 minutes or more, e.g. `in 23 hours`
161
- * - Minutes will be used for anything 1 second or more, e.g. `1 minute ago` or `in 59 minutes`
158
+ * - Weeks will be used for anything 10 days or more, e.g. `in 9 weeks`
159
+ * - Days will be used for anything 1 day or more, e.g. `in 13 days`
160
+ * - Hours will be used for anything 1 hour or more, e.g. `in 23 hours`
161
+ * - Minutes will be used for anything 1 minute or more, e.g. `1 minute ago` or `in 59 minutes`
162
162
  * - Seconds will be used for anything 1000 milliseconds or more, e.g. `in 59 seconds`
163
163
  */
164
164
  export function getBestTimeUnit(ms) {
165
165
  const abs = Math.abs(ms);
166
- if (abs > 18 * MONTH)
166
+ if (abs >= 18 * MONTH)
167
167
  return TIME_UNITS.require("year");
168
- if (abs > 10 * WEEK)
168
+ if (abs >= 10 * WEEK)
169
169
  return TIME_UNITS.require("month");
170
- if (abs > DAY)
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 > HOUR)
174
+ if (abs >= HOUR)
173
175
  return TIME_UNITS.require("hour");
174
- if (abs > MINUTE * 90)
176
+ if (abs >= MINUTE)
175
177
  return TIME_UNITS.require("minute");
176
- if (abs > SECOND)
178
+ if (abs >= SECOND)
177
179
  return TIME_UNITS.require("second");
178
180
  return TIME_UNITS.require("millisecond");
179
181
  }