numberToSimpleDate returns day 0 for 31 December of some years when leapYear1900 is true

Open Beginner friendly
#1,793 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@aliassar is already working on this.

Since Nov 3, 2026.

  • #1873 by @aliassar — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Locate the numberToSimpleDate function in the HyperFormula codebase. The bug is in the year check where it compares against {year: year - 1, …} instead of {year, …}. Fix that comparison, then run the date, EDATE, EOMONTH and DAY specs to verify the fix resolves the 32 affected years without breaking existing behavior.

Written by the indexing model from the issue text.

Description

With leapYear1900: true, numberToSimpleDate decomposes 31 December of 32 years between 1900 and 2200 (for example 2036 and 2040) as day 0 of January of the next year. =EOMONTH(DATE(2036,12,31),0) returns 31 January 2037, and TEXT of that serial shows 2037-01-00. It happens with and without nullDate 1899-12-31.

The year check in that function compares against {year: year - 1, …} where {year, …} looks intended. Changing it brings the 32 affected years to 0 in both leap configurations, leaves the default configuration unchanged, and the 80 date, EDATE, EOMONTH and DAY specs I ran still pass.

Found while reviewing #1781. That PR doesn't cause it.

Dominant language
TypeScript
Stars
2.8k
Forks
175
Avg merge
2d 7h
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from handsontable/hyperformula

All issues in handsontable/hyperformula

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.