Skip to content

fix(sheet): sort a date or time column by its value - #980

Merged
andiwand merged 1 commit into
mainfrom
fix/sort-dates-by-value
Oct 4, 2026
Merged

andiwand merged 1 commit into
mainfrom
fix/sort-dates-by-value

Conversation

@andiwand

@andiwand andiwand commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

The sort control of a sheet read a date cell as text. A numeric text comparison put 02.01.2025 before 10.12.2024, so a date column sorted in the wrong order.

Change

  • keyOf in spreadsheet.js sorts a cell that states data-odr-value by that value, as a number. A plain float cell still reads its number from its text, and every other cell sorts as text.
  • translate_sheet writes data-odr-value on a date or time cell in a read-only render too, because a date's text gives no way back to its value. A formatted float still states its value only in the editable render, because toNumber reads it from its text.

Reference output

No page changes. The editable render already writes the value since #979, and the read-only file_example_ODS_100.ods holds no date, so its output is byte-identical. Only resources/spreadsheet.js changes in the two output repositories. I will copy it there after the merge.

Proof

  • sorting.html has a new date column whose text order differs from its value order. The new check passes, and it fails with the script from main. All eleven sheet pages pass in headless Chrome.
  • html.a_date_and_a_time_state_their_value checks both renders. html.a_formatted_number_states_its_value checks that a read-only render still writes no value on a number. All 77 html tests pass.

🤖 Generated with Claude Code

The sort read a date cell as text, so `02.01.2025` came before
`10.12.2024`. A date or time cell states `data-odr-value` in a read-only
render too, because its text gives no way back to its value, and the sort
orders every cell that states a value by it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011qFgpigFCwbfZ24TFj7eqA
@andiwand
andiwand merged commit e01c0bb into main Oct 4, 2026
23 checks passed
@andiwand
andiwand deleted the fix/sort-dates-by-value branch October 4, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant