gristlabs_grist-core/app/client/widgets
Alex Hall 5b352211c4 (core) Guess date format during type conversion
Summary:
- Adds a dependency moment-guess (https://github.com/apoorv-mishra/moment-guess) to guess date formats from strings. However the npm package is missing source maps which leads to an ugly warning, so currently using a fork until https://github.com/apoorv-mishra/moment-guess/pull/22 is resolved.
- Adds guessDateFormat using moment-guess to determine the best candidate date format. The logic may be refined for e.g. lossless imports where the stakes are higher, but for now we're just trying to make type conversions smoother.
- Uses guessDateFormat to guess widget options when changing column type to date or datetime.
- Uses the date format of the original column when possible instead of guessing.
- Fixes a bug where choices were guessed based on the display column instead of the visible column, which made the guessed choices influenced by which values were referenced as well as completely broken when converting from reflist.
- @dsagal @georgegevoian This builds on https://phab.getgrist.com/D3265, currently unmerged. That diff was created first to alert to the change. Without it there would still be similar test failures/changes here as the date format would often be concretely guessed and saved as YYYY-MM-DD instead of being left as the default `undefined` which is shows as YYYY-MM-DD in the dropdown.

Test Plan: Added a unit test to `parseDate.ts`. Updated several browser tests which show the guessing in action during type conversion quite nicely.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: dsagal, georgegevoian

Differential Revision: https://phab.getgrist.com/D3264
2022-02-21 22:39:47 +02:00
..
AbstractWidget.js
AttachmentsEditor.ts
AttachmentsWidget.css
AttachmentsWidget.ts
BaseEditor.js Correct spelling mistakes 2022-02-19 09:46:49 +00:00
CheckBox.css
CheckBox.js
CheckBoxEditor.js
ChoiceEditor.js
ChoiceListCell.ts (core) Fix choice/ref list cell color not filling cell 2022-01-20 14:58:20 -08:00
ChoiceListEditor.ts
ChoiceListEntry.ts (core) Summary columns improvemnt. 2022-01-25 17:51:48 +01:00
ChoiceTextBox.ts (core) Improving experience when editing group-by column. 2022-01-18 14:31:31 +01:00
ChoiceToken.ts
CurrencyPicker.ts
DateEditor.js
DateTextBox.js (core) Guess date format during type conversion 2022-02-21 22:39:47 +02:00
DateTimeEditor.css
DateTimeEditor.js
DateTimeTextBox.js (core) Guess date format during type conversion 2022-02-21 22:39:47 +02:00
DiffBox.ts
EditorButtons.ts
EditorPlacement.ts
EditorTooltip.ts
ErrorDom.ts
FieldBuilder.css
FieldBuilder.ts (core) Initial data tables page 2022-02-10 12:46:19 +02:00
FieldEditor.ts Correct spelling mistakes 2022-02-19 09:46:49 +00:00
FormulaEditor.ts
HyperLinkEditor.ts
HyperLinkTextBox.ts
NewAbstractWidget.ts (core) Reference and ReferenceList formatters 2022-01-13 18:09:33 +02:00
NewBaseEditor.ts Correct spelling mistakes 2022-02-19 09:46:49 +00:00
NTextBox.ts (core) Reference and ReferenceList formatters 2022-01-13 18:09:33 +02:00
NTextEditor.ts
NumericTextBox.ts
Reference.css
Reference.ts (core) Reference and ReferenceList formatters 2022-01-13 18:09:33 +02:00
ReferenceEditor.ts
ReferenceList.ts (core) Reference and ReferenceList formatters 2022-01-13 18:09:33 +02:00
ReferenceListEditor.ts
Spinner.css
Spinner.ts
Switch.css
Switch.js
TextBox.css
TextEditor.css
TextEditor.js
TZAutocomplete.ts (core) Improving experience when editing group-by column. 2022-01-18 14:31:31 +01:00
UserType.js
UserTypeImpl.js