From 2476a47afef931030d1f0d93e05f35c0fe149719 Mon Sep 17 00:00:00 2001 From: Isaac Levy Date: Thu, 27 May 2021 08:16:42 -0400 Subject: [PATCH] Document argumentless diff dayjs.diff() calculates the diff to current time. --- types/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index d83c9dde3..0b9a47622 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -286,7 +286,9 @@ declare namespace dayjs { * const date1 = dayjs('2019-01-25') * const date2 = dayjs('2018-06-05') * date1.diff(date2) // 20214000000 default milliseconds + * date1.diff() // milliseconds to current time * ``` + * * To get the difference in another unit of measurement, pass that measurement as the second argument. * ``` * const date1 = dayjs('2019-01-25') @@ -296,7 +298,7 @@ declare namespace dayjs { * * Docs: https://day.js.org/docs/en/display/difference */ - diff(date: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number + diff(date?: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number /** * This returns the number of **milliseconds** since the Unix Epoch of the Day.js object. * ```