mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
9d62e67369
Summary: Reference/referencelist columns displaying date/datetime columns didn't show the formatting of that column, formatting them as ISO instead. One weird effect of this was that opening the editor suddenly changed the format because the editor formatted the dates correctly. You can see this in the checkin doc as an example. This was discussed in https://grist.slack.com/archives/C0234CPPXPA/p1636482208111800. Here's the main point: > both use the visible column formatter's formatAny. the editor uses the value from the visible column, which for a date column is a raw timestamp number. the cell display uses the value from the display column which is of type Any so the value is wrapped in a list starting with 'd'. the former gets formatted according to the formatting options, but the latter just gets formatted as ISO. Probably a good solution to the broader problem is to ensure that the display column has the same type and widget options as the visible column. That seems potentially messy, so I did something easier: fix `DateFormatter` to accept encoded date/datetime objects. It still receives the correct widget options from the visible column as before but can handle the values from the display column. This might also have other uses in the future. Test Plan: - Fixed several tests which previously expected the buggy behaviour. - Converted ValueFormatter.js tests to typescript and cleaned up the existing code slightly. - Added tests for DateFormatter and DateTimeFormatter to the ValueFormatter test suite, which only tested numbers before. Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3190 |
||
---|---|---|
.. | ||
client | ||
common | ||
gen-server | ||
plugin | ||
server | ||
tsconfig.json |