sbmdkl / nepali-datepicker-reactjs

20 stars 16 forks source link

default value of date picker #7

Closed narendrachettri closed 3 years ago

narendrachettri commented 3 years ago

i want a value from date picker only when i select a date. It's giving a default value which i don't want. Can you help on this

sbmdkl commented 3 years ago

Hi @narendrachettri, thanks for creating this issue. You can now have the feature to hideDefaultValue and have your own placeholder @ version >= 1.2.0 pass hideDefaultValue as a props to Calendar component.

        <Calendar
          hideDefaultValue={true}
          placeholder="मिति छान्नुहोस्"
          onChange={this.onChange}
        />

demo: https://codesandbox.io/s/friendly-keller-0vyjq?file=/src/App.js

narendrachettri commented 3 years ago

it's not solved yet. onChange function getting bsDate and adDate value without changing the value. Check it once. It's taking current date inside a onchange function. Can you fix this. Because it will submit a current date even i left it blank, which i am getting an issue with. Even you can check it on sandbox by doing console log you will understand where the problem is otherwise everything is great.

On Thu, Sep 23, 2021 at 7:15 PM Shubham Dhakal @.***> wrote:

Closed #7 https://github.com/sbmdkl/nepali-datepicker-reactjs/issues/7.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sbmdkl/nepali-datepicker-reactjs/issues/7#event-5349851717, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WF2A4FQ73RUDO56XHPYTUDMTWBANCNFSM5ELQEQ5Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

narendrachettri commented 3 years ago

check this out you will know the problem. Behind the scene it's triggering onchange on first render and giving current date value. by which if i submit the form without taking a value from datepicker it will give me a current date. which is inefficient and force me to insert a false data. Can you fix this problem.

On Thu, Sep 23, 2021 at 6:45 PM Shubham Dhakal @.***> wrote:

Hi @narendrachettri https://github.com/narendrachettri, thanks for creating this issue. You can now have the feature to hideDefaultValue and have your own placeholder @ version >= 1.2.0 pass hideDefaultValue as a props to Calendar component.

    <Calendar

      hideDefaultValue={true}

      placeholder="मिति छान्नुहोस्"

      onChange={this.onChange}

    />

demo: https://codesandbox.io/s/friendly-keller-0vyjq?file=/src/App.js

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sbmdkl/nepali-datepicker-reactjs/issues/7#issuecomment-925794255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WF2FAMUIHO35BK7Y4FUDUDMQH7ANCNFSM5ELQEQ5Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.