From f6ac653442b316fd3d64111d85d1a2637e455138 Mon Sep 17 00:00:00 2001 From: gigobyte Date: Tue, 24 Jan 2023 21:59:58 +0200 Subject: [PATCH] Just Date gives unexpected result when applying JSON.stringify() #613 --- src/Maybe.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Maybe.ts b/src/Maybe.ts index b711ff66..bad14b35 100644 --- a/src/Maybe.ts +++ b/src/Maybe.ts @@ -208,7 +208,8 @@ class Just implements Maybe { } toJSON(): T { - return this.__value + const value: any = this.__value + return value instanceof Date ? value.toJSON() : value } equals(other: Maybe): boolean {