angular-datetime-range icon indicating copy to clipboard operation
angular-datetime-range copied to clipboard

Feature for null start/end dates

Open amit777 opened this issue 6 years ago • 6 comments

Would it be possible to allow for null values for the start and ends dates. Null would indicate indefinite start or end. Kind of like infinity.

amit777 avatar Jan 20 '18 21:01 amit777

Let me see if I understand you correctly, you want to have unset datetime objects before the user selects a date, right? Right now if the date is not set it's 'undefined' by default and shows a placeholder instead. What would be the displayed as a placeholder for a null value?

g1eb avatar Jan 21 '18 05:01 g1eb

oh, sorry, if it's undefined then that should work! I think I missed that. My goal is to let someone say "X starts on 2/2/18 and goes indefinitely". I could just create a button that sets either the start or end to undefined then.

amit777 avatar Jan 21 '18 21:01 amit777

so if I tried to use the directive and both start and end are undefined, I am not able to click either the start or end date. I just see this:

<datetime-range start="item.start" end="item.end"></datetime-range>

screen shot 2018-01-21 at 3 48 52 pm

amit777 avatar Jan 21 '18 23:01 amit777

If i set item.start to a new moment(0), then if I click the undefined item.end date, i get the following error in console:

TypeError: Cannot read property 'clone' of undefined
    at m.a.selectDate 

amit777 avatar Jan 21 '18 23:01 amit777

Ahh, interesting... It seems like the start and end dates can not be undefined after all. I think I was confused with the other angular datetime input directives that has placeholders..

Would you be able to use start and end datetime as separate directives from the other library or would you prefer adding placeholders and undefined range support here?

g1eb avatar Jan 22 '18 22:01 g1eb

I would highly appreciate such a feature in this one. With two of the other i still would have to encapsulate it to another directive to be have validations and so on.

stanglt avatar Apr 26 '18 14:04 stanglt