File tree Expand file tree Collapse file tree 3 files changed +26
-14
lines changed
Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 11import { getRoundingMethod } from "../_lib/getRoundingMethod/index.js" ;
22import { constructFrom } from "../constructFrom/index.js" ;
33import { toDate } from "../toDate/index.js" ;
4- import type { NearestHoursOptions , RoundingOptions } from "../types" ;
4+ import type {
5+ NearestHours ,
6+ NearestToUnitOptions ,
7+ RoundingOptions ,
8+ } from "../types.js" ;
59
610/**
711 * The {@link roundToNearestHours} function options.
812 */
913export interface RoundToNearestHoursOptions
10- extends NearestHoursOptions ,
14+ extends NearestToUnitOptions < NearestHours > ,
1115 RoundingOptions { }
1216
1317/**
Original file line number Diff line number Diff line change 11import { getRoundingMethod } from "../_lib/getRoundingMethod/index.js" ;
22import { constructFrom } from "../constructFrom/index.js" ;
33import { toDate } from "../toDate/index.js" ;
4- import type { NearestMinutesOptions , RoundingOptions } from "../types.js" ;
4+ import type {
5+ NearestMinutes ,
6+ NearestToUnitOptions ,
7+ RoundingOptions ,
8+ } from "../types.js" ;
59
610/**
711 * The {@link roundToNearestMinutes} function options.
812 */
913export interface RoundToNearestMinutesOptions
10- extends NearestMinutesOptions ,
14+ extends NearestToUnitOptions < NearestMinutes > ,
1115 RoundingOptions { }
1216
1317/**
Original file line number Diff line number Diff line change @@ -280,20 +280,24 @@ export type NearestMinutes =
280280 | 29
281281 | 30 ;
282282
283- /**
284- * The nearest minutes function options. Used to build function options.
285- */
286- export interface NearestMinutesOptions {
287- /** The nearest number of minutes to round to. E.g. `15` to round to quarter hours. */
288- nearestTo ?: NearestMinutes ;
289- }
290-
291283/**
292284 * Nearest hour type. Goes from 1 to 12, where 1 is the nearest hour and 12
293285 * is nearest half a day.
294286 */
295287export type NearestHours = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 ;
296288
297- export interface NearestHoursOptions {
298- nearestTo ?: NearestHours ;
289+ /**
290+ * The nearest minutes function options. Used to build function options.
291+ *
292+ * @deprecated Use {@link NearestToUnitOptions} instead.
293+ */
294+ export type NearestMinutesOptions = NearestToUnitOptions < NearestMinutes > ;
295+
296+ /**
297+ * The nearest unit function options. Used to build function options.
298+ */
299+ export interface NearestToUnitOptions < Unit extends number > {
300+ /** The nearest unit to round to. E.g. for minutes `15` to round to quarter
301+ * hours. */
302+ nearestTo ?: Unit ;
299303}
You can’t perform that action at this time.
0 commit comments