Skip to content

Commit a600873

Browse files
committed
refactor
1 parent e644f00 commit a600873

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

std/assembly/date.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,10 @@ function dayOfWeek(year: i32, month: i32, day: i32): i32 {
361361
const tab = memory.data<u8>([0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]);
362362

363363
year -= i32(month < 3);
364-
365364
const century = floorDiv(year >> 2, 100 >> 2);
366365
year += (year >> 2) + (century >> 2) - century;
367-
368-
const monthOffset = <i32>load<u8>(tab + month - 1);
369-
return euclidRem(year + monthOffset + day, 7);
366+
month = <i32>load<u8>(tab + month - 1);
367+
return euclidRem(year + month + day, 7);
370368
}
371369

372370
function stringify(value: i32, padding: i32 = 2): string {

0 commit comments

Comments
 (0)