Record planting day and show harvest dates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-06 10:07:21 +01:00
parent 07057e6c3d
commit 83a9cb6dcc
11 changed files with 282 additions and 44 deletions

View file

@ -12,3 +12,13 @@ assert.equal(calendar.birthdayOn(birthdays, "spring", 7, 2), "Lewis");
assert.equal(calendar.birthdayOn(birthdays, "spring", 8, 1), null);
console.log("calendar tests passed");
// Parsnip (4 days) planted on Spring 1 is ready on Spring 5.
assert.deepEqual(calendar.harvestDate({ year: 1, season: "spring", day: 1 }, 4), { year: 1, season: "spring", day: 5 });
// Corn planted late in Summer finishes in Fall; Winter rolls over into the next year.
assert.deepEqual(calendar.harvestDate({ year: 1, season: "summer", day: 20 }, 14), { year: 1, season: "fall", day: 6 });
assert.deepEqual(calendar.harvestDate({ year: 1, season: "winter", day: 28 }, 1), { year: 2, season: "spring", day: 1 });
assert.equal(calendar.daysBetween({ year: 1, season: "spring", day: 3 }, { year: 1, season: "spring", day: 5 }), 2);
assert.equal(calendar.daysBetween({ year: 1, season: "fall", day: 2 }, { year: 1, season: "summer", day: 28 }), -2);
console.log("harvest date tests passed");