egui icon indicating copy to clipboard operation
egui copied to clipboard

Changed datepicker widget from egui_extras to use DateTime

Open terafo opened this issue 2 years ago • 1 comments

Chrono crate advises not to use Date type, and, to discourage to use it, that type is non serializable with serde. Since persistence feature of eframe requires serde, is is impossible to make datepicker state persistent without conversions. Switching Date type to Datetime fixes that issue.

terafo avatar Aug 10 '22 20:08 terafo

Whilst I agree that attaching time to explicit date functionality is not perfect, I'd strongly shy away from any custom Date type. The cleanest choice might be to extend the widget to include time (and default to zero time as in the pull), and adopt the ecosystem time standard. I found this pull looking for a date time picker widget!

dvg-vitol avatar Sep 13 '22 09:09 dvg-vitol

Chrono API documentation recommends using NaiveDate instead of Date, which would make sense here since the datepicker widget is time zone agnostic. NaiveDate implements serde::Serialize, it is also directly supported by ORMs like Diesel.

JoshLambda avatar Oct 08 '22 16:10 JoshLambda