fooloomanzoo / datetime-picker

A minimal picker for date and time for Polymer, that can use the native input
MIT License
78 stars 18 forks source link

Empty value #33

Closed brettpostin closed 6 years ago

brettpostin commented 6 years ago

Apologies if I've missed something, but I can't see a way to set an empty value?

In the absence of data I would like a blank field rather than it default to the current date/time.

Is there a way to achieve this?

fooloomanzoo commented 6 years ago

By default, today is the picked date, if not any attribute is set, but I might change that behaviour

brettpostin commented 6 years ago

Ok thanks for the clarification.

I would love to use this element as it looks the most complete datetime picker available. However at present I cannot see how I would use this in a form where the field value may not be required.

I noticed there is a required property, what function does this serve if the field always has a value?

fooloomanzoo commented 6 years ago

The required property comes from my FormElementMixin and this mixin is used also by other input elements I made. For Polymer's iron-form-element it is required for an element to have a validate function and so I created this mixin and included some shared attributes. Formerly it did not have that attribute, but I look into it.

brettpostin commented 6 years ago

Support for empty values would be a welcome addition.

fooloomanzoo commented 6 years ago

@brettpostin It should be possible with the new update. Please have a look at the demo

brettpostin commented 6 years ago

Awesome thank you! Is there a way to clear the value back to empty once it has been set?

fooloomanzoo commented 6 years ago

Right and thanks, should be fixed in the current version