Closed pkalita-lbl closed 1 year ago
@ddooley I've had a little time to work on #391 here and there over the last week or two. Here's some in-progress work that might be worth checking out. The goal here is to unify the input of dates, times, and datetimes.
I ended up using the flatpickr library to render date, time, and datetime pickers. I initially tried to use the native <input>
types, but I had forgotten how limiting those are in terms of display formatting. I think flatpickr is a good alternative because it's widely used, actively maintained, and has no external dependencies. The flatpickr setup is contained in a set of custom cell editors.
Implementing custom cell editors is a bit complex, and I'm not 100% sure I got all of the details exactly right. If you have time to checkout this branch and test it locally I'd appreciate it. I've added a small test schema for convenience (which I'll remove if/when we're ready to go forward with this).
@ddooley I think this read for review now. Please let me know if you'd like me to walk you through any of it!
DataHarmonizer
constructor. Acceptable values for these options should be based on the Unicode standard date and time tokens. Fixes #391dataArrayToObject
anddataObjectToArray
used in JSON import/export aware of theDataHarmonizer
instance's date and time formats and provide finer control over how to serialize/deserialize dates. This is ultimately controlled by another newDataHarmonizer
constructor option. The default is that exported JSON will have dates in a format that is compatible with JSON Schema validation. Other possible options are having dates serialized according to the default serialization of Date objects or in the same format as they're displayed in the Handsontable grid. Fixes #389.