Skip to content

Commit

Permalink
Document argumentless diff
Browse files Browse the repository at this point in the history
dayjs.diff() calculates the diff to current time.
  • Loading branch information
isaacl committed May 27, 2021
1 parent 06f88f4 commit 2476a47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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.
* ```
Expand Down

0 comments on commit 2476a47

Please sign in to comment.