From 13801f816f0325fc86cbdbd72cf015f6c3728cb0 Mon Sep 17 00:00:00 2001 From: Zhiwei Shen Date: Fri, 18 Mar 2022 14:30:41 +0800 Subject: [PATCH] fix setUTCMonth this.month is the real month, but setUTCMonth value is 0 ~ 11 --- std/assembly/date.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/assembly/date.ts b/std/assembly/date.ts index 8f219b7100..d9ae5bd38c 100644 --- a/std/assembly/date.ts +++ b/std/assembly/date.ts @@ -169,7 +169,7 @@ export class Date { } setUTCMonth(month: i32): void { - if (this.month == month) return; + if (this.month == month + 1) return; var ms = euclidRem(this.epochMillis, MILLIS_PER_DAY); this.setTime(i64(daysSinceEpoch(this.year, month + 1, this.day)) * MILLIS_PER_DAY + ms); }