ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

Default date behavior #158

Closed oryam closed 7 years ago

oryam commented 7 years ago

Steps to reproduce and a minimal demo

Current behavior

Expected/desired behavior

allenhwkim commented 7 years ago

@oryam thanks for reporting this. will be looked into.

allenhwkim commented 7 years ago

@oryam ng2-ui is behind the current version of ng2-datetime-picker. This will be fixed when ng2-ui is up-to-date. Please log this issue not at ng2-ui/datetime-picker, but at ng2-ui/ng2-ui

oryam commented 7 years ago

Ok. Thank you for your comment. I posted an issue https://github.com/ng2-ui/ng2-ui/issues/23

allenhwkim commented 7 years ago

My mistake, it is actually not related to version. it seems like a bug for this module.

oryam commented 7 years ago

Hello,

For information, the new condition else if (dateStr.length > 4) { and the default else are never called if I am setting the date-format or/and parse-format. Is it the expected behavior?

In my case, with using a date-format or/and parse-format, it would be great to have the calendar on the current date if the parsing failed.

<md-input-container class="fiw-input fiw-datepicker-right">
                <input mdInput 
                    formControlName="validityDate"
                    autocomplete="off"
                    maxlength="10"
                    ng2-datetime-picker
                    date-only="true"
                    date-format="YYYY/MM/DD"
                    parse-format="YYYY/MM/DD"
                >
            </md-input-container>

I have momentjs, to use YYYY/MM/DD pattern.