click-datetime icon indicating copy to clipboard operation
click-datetime copied to clipboard

Add Date type

Open rsyring opened this issue 7 years ago • 3 comments

Could you add a date type, for when we want dates without times?

rsyring avatar Apr 07 '18 19:04 rsyring

Is this really useful? You can specify a custom date format and only parse the date components, then only use the date component of the date time

ddaws avatar Sep 09 '24 23:09 ddaws

Is this really useful? Y ou can specify a custom date format and only parse the date components, then only use the date component of the date time

It's a small benefit. Mostly semantic I guess. But date != datetime, I like to be precise. :)

rsyring avatar Sep 10 '24 00:09 rsyring

More specifically: datetime.date is a different type from datetime.datetime, and they are not interchangeable (e.g., some_date < some_datetime does not work).

If you have code that uses dates, and you want a user option that provides a date, with click.DateTime you need to do shenanigans somewhere to cast the datetime values into date, and the typing of your command methods is inaccurate (because the method signature needs to say datetime when what it really should get is date), etc.

mdoggydog avatar Sep 27 '24 15:09 mdoggydog