interactive icon indicating copy to clipboard operation
interactive copied to clipboard

Pretty print DateOnly and TimeOnly

Open nhirschey opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. DateTime has a nice pretty printer. It would be useful to have this for DateOnly and TimeOnly too. I know that I can use the object formatters to do it myself, but having it built in is easier to use.

image

Describe the solution you'd like Output printers for DateOnly that are like DateTime and for TimeOnly that are like TimeSpan

Such as:

Formatter.Register<DateOnly>(fun (dt: DateOnly) -> dt.ToString("o"))
Formatter.SetPreferredMimeTypesFor(typeof<DateOnly>,"text/plain")

Formatter.Register<TimeOnly>(fun (tm: TimeOnly) -> tm.ToString("o"))
Formatter.SetPreferredMimeTypesFor(typeof<TimeOnly>,"text/plain")

Describe alternatives you've considered Do it manually on every notebook.

nhirschey avatar Aug 28 '22 19:08 nhirschey