kekeh / angular-mydatepicker

Angular datepicker and date range picker :date:
https://kekeh.github.io/angular-mydatepicker/
MIT License
1 stars 11 forks source link

Invalid date range if I change dateRangeDatesDelimiter #29

Closed pin8marian closed 4 years ago

pin8marian commented 4 years ago

Hi. I just want to start by saying you are doing an amazing job. Thank you. I saw the following behavior: The selected date range is not valid in case I add another delimiter. Example: myDpOptions: IAngularMyDpOptions = { dateRange: true, dateRangeDatesDelimiter: "#", dateFormat: 'dd-mmm-yyyy', }

and the picked date is 11-Feb-2020#21-Feb-2020 in isDateValid , the "#" it won't get into the delimiters variable, that means when it will call getNumberByValue(dateValue[2]) , dateValue[2] will be "2020#21" and will return year=0, day=0, month=0, which is invalid.

kekeh commented 4 years ago

Thank you @pin8marian

Instead of dateRangeDatesDelimiter: "#" try dateRangeDatesDelimiter: " # "

Or do you want to use value of it without spaces?

pin8marian commented 4 years ago

Thank you @pin8marian

Instead of dateRangeDatesDelimiter: "#" try dateRangeDatesDelimiter: " # "

Or do you want to use value of it without spaces?

Well, even if I put " # " or "#" it will still get as invalid date because will take the empty space into date. Like this: Ex of date: 11-Feb-2020 # 21-Feb-2020 dateValue[2] will be "2020 " (see the space after 2020)

kekeh commented 4 years ago

I have fixed this issue. Can you try version 0.4.1.

pin8marian commented 4 years ago

I have fixed this issue. Can you try version 0.4.1.

Do I need to upgrade to angular 9 version to use 0.4.1 version?

Thank you M

kekeh commented 4 years ago

You can use this component if your Angular version is >= 7.2. Maybe also earlier Angular versions work. I have tested this component only Angular 7.2 onwards.