Skip to content

Commit fa78a88

Browse files
committed
Add Date as well
1 parent 2b5a8fc commit fa78a88

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

runtime/Stdlib_Date.resi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,27 @@ Returns the time, in milliseconds, between UNIX epoch (January 1, 1970 00:00:00
428428
@val
429429
external now: unit => msSinceEpoch = "Date.now"
430430

431+
/**
432+
`equal(date1, date2)` checks if two dates represent the same point in time.
433+
434+
## Examples
435+
```rescript
436+
Date.equal(Date.fromString("2023-01-01"), Date.fromString("2023-01-01")) == true
437+
Date.equal(Date.fromString("2023-01-01"), Date.fromString("2023-01-02")) == false
438+
```
439+
*/
431440
let equal: (t, t) => bool
432441

442+
/**
443+
`compare(date1, date2)` compares two dates chronologically, returns an `Ordering.t` value.
444+
445+
## Examples
446+
```rescript
447+
Date.compare(Date.fromString("2023-01-01"), Date.fromString("2023-01-01")) == Ordering.equal
448+
Date.compare(Date.fromString("2023-01-01"), Date.fromString("2023-01-02")) == Ordering.less
449+
Date.compare(Date.fromString("2023-01-02"), Date.fromString("2023-01-01")) == Ordering.greater
450+
```
451+
*/
433452
let compare: (t, t) => Stdlib_Ordering.t
434453

435454
/**

0 commit comments

Comments
 (0)