Skip to content

Commit

Permalink
Just Date gives unexpected result when applying JSON.stringify() #613
Browse files Browse the repository at this point in the history
  • Loading branch information
gigobyte committed Jan 24, 2023
1 parent ea62f0a commit f6ac653
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Maybe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ class Just<T> implements Maybe<T> {
}

toJSON(): T {
return this.__value
const value: any = this.__value
return value instanceof Date ? value.toJSON() : value
}

equals(other: Maybe<T>): boolean {
Expand Down

0 comments on commit f6ac653

Please sign in to comment.