Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customDateFormat shows 'undefined' when you manually erase the date #2693

Closed
3 tasks done
Frenzie opened this issue Oct 21, 2022 · 8 comments
Closed
3 tasks done

customDateFormat shows 'undefined' when you manually erase the date #2693

Frenzie opened this issue Oct 21, 2022 · 8 comments
Labels
Area: TypeScript Priority: Medium State: Pending Release This issue has been resolved in the dev branch and is waiting on a new release Type: Bug

Comments

@Frenzie
Copy link

Frenzie commented Oct 21, 2022

Prerequisites

Describe the issue

See the sample on https://getdatepicker.com/6/plugins/customDateFormat.html

Steps to reproduce

  1. Set a date
  2. Empty the input
  3. The input now shows 'undefined'
    image

Expected

It's just empty.

StackBlitz fork

https://getdatepicker.com/6/plugins/customDateFormat.html

What operating system(s) are you seeing the problem on?

Windows, macOS, Android, iOS, Linux

What browser(s) are you seeing the problem on?

Chrome, Safari, Firefox, Microsoft Edge, Opera

What version of are you using? You can find this information from the sample StackBlitz.

v6.2.4

What your browser's locale? You can find this information from the sample StackBlitz.

en-US

@Frenzie Frenzie added State: Triage Tickets that need to be triaged. Type: Bug labels Oct 21, 2022
@Eonasdan Eonasdan added Area: TypeScript Priority: Medium and removed State: Triage Tickets that need to be triaged. labels Oct 24, 2022
@JerryBels
Copy link

Came here to report exactly that... +1

@dcopadosalmeron
Copy link

dcopadosalmeron commented Oct 27, 2022

By default, the "defaultDate" option is equal to undefined. Just set this option to double quotes: defaultDate: ""
doc

@Frenzie
Copy link
Author

Frenzie commented Oct 27, 2022

An empty or random string doesn't seem to be accepted. At a glance only an ISO string or a Date object are accepted.

But luckily defaultDate doesn't affect the steps described regardless. If it did you could just replace undefined in my OP with defaultDate. ;-)

The correct behavior is observed when you click the trashcan from adding clear: true and when customDateFormat isn't enabled:

    buttons:{
      clear: true
    },

@JerryBels
Copy link

Yes I can confirm defaultDate doesn't have anything to do with the matter.

Eonasdan added a commit that referenced this issue Oct 31, 2022
@Eonasdan
Copy link
Owner

hi. I believe this is resolved in the related branch. Please check this stackblitz

@Frenzie
Copy link
Author

Frenzie commented Nov 2, 2022

I don't think I understand the other changes but the if (!date) return '' part seems to have the intended effect. 👍

@Eonasdan
Copy link
Owner

Eonasdan commented Nov 2, 2022

Yeah I'm still trying to get the plugin to behave with time zone bits and thought I could squeeze it in. Glad it's working, I'll get it pub'd soon.

@Eonasdan Eonasdan added State: Pending Release This issue has been resolved in the dev branch and is waiting on a new release and removed State: Waiting feedback labels Nov 2, 2022
@Eonasdan Eonasdan mentioned this issue Nov 5, 2022
Eonasdan added a commit that referenced this issue Nov 5, 2022
@Eonasdan Eonasdan mentioned this issue Nov 5, 2022
Eonasdan added a commit that referenced this issue Nov 5, 2022
<h2>6.2.7</h2>
      <h3>Bug fixes</h3>
      <ul>
        <li>Fixed customDateFormat shows 'undefined' when you manually erase the date #2693</li>
        <li>Fixed calendar header not updating correctly #2685</li>
        <li>Fixed clock components disappearing when using side by side #2684</li>
        <li>Fixed some doc issues #2706</li>
      </ul>
      <h3>New</h3>
      <ul>
        <li>Unit tests! #2711</li>
    </ul>
@Eonasdan
Copy link
Owner

Eonasdan commented Nov 5, 2022

Hello. This should be fixed in 6.2.7

@Eonasdan Eonasdan closed this as completed Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: TypeScript Priority: Medium State: Pending Release This issue has been resolved in the dev branch and is waiting on a new release Type: Bug
Projects
Archived in project
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants