fix(sheet): sort a date or time column by its value - #980
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The sort control of a sheet read a date cell as text. A numeric text comparison put
02.01.2025before10.12.2024, so a date column sorted in the wrong order.Change
keyOfinspreadsheet.jssorts a cell that statesdata-odr-valueby that value, as a number. A plain float cell still reads its number from its text, and every other cell sorts as text.translate_sheetwritesdata-odr-valueon 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, becausetoNumberreads 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.odsholds no date, so its output is byte-identical. Onlyresources/spreadsheet.jschanges in the two output repositories. I will copy it there after the merge.Proof
sorting.htmlhas 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_valuechecks both renders.html.a_formatted_number_states_its_valuechecks that a read-only render still writes no value on a number. All 77htmltests pass.🤖 Generated with Claude Code