Giter Club home page Giter Club logo

Comments (15)

chmln avatar chmln commented on June 18, 2024 1

Hi Rafael,

You may now take advantage of the defaultDate option.
You can also hardcode self.element.value and then self.redraw().

Also, the datepicker now always opens on the selected date (if any), or the defaultDate (if specified), or today's date, when closed and reopened.

from flatpickr.

rafaelrenanpacheco avatar rafaelrenanpacheco commented on June 18, 2024

Hi Gregory!

Thanks for the fast feedback.

I tried this new defaultDate option on the sample page, and I think it is not working.

The doc says: "Set the date to highlight on first opening if the associated input field is blank. Specify either an actual date via a Date object or as a string"

But this is the result:

date

The datepicker popup does not focus the defaultDate.

Best regards.

from flatpickr.

chmln avatar chmln commented on June 18, 2024

You might have to refresh the browser cache, I just verified it working on multiple machines.

Let me know if the problem persists.

from flatpickr.

rafaelrenanpacheco avatar rafaelrenanpacheco commented on June 18, 2024

On Chrome 45, anonymous mode, with cleared cache, the behavior stills the same :(

No console errors as well.

from flatpickr.

rafaelrenanpacheco avatar rafaelrenanpacheco commented on June 18, 2024

Hi there!

The new "data-defaultDate" alternative does work, selecting the "2016-1-10" date when the popup is open.

The defDate.set('defaultDate', '2015-10-10') still not working on the sample page, as shown in the print before this post.

Did you try to simulate on Chrome 45?

Best regards.

from flatpickr.

adaniello avatar adaniello commented on June 18, 2024

Hi, for me the same issue

from flatpickr.

chmln avatar chmln commented on June 18, 2024

Hello,

Make sure you're using the latest version of flatpickr.

I also made a demo page for this current issue, please verify that its working there.

Thank you. :)

from flatpickr.

rafaelrenanpacheco avatar rafaelrenanpacheco commented on June 18, 2024

Hi Greg, all the reports were verified on the main demo page. I did not download the master to test locally, because the demo page just don't work for that feature (http://chmln.github.io/flatpickr/)

About the demo page for this issue (http://chmln.github.io/flatpickr/issue-4-demo/), it has wrong attr name. The code has "data-defaultdate", but the doc says it should be "data-defaultDate", which made the sample of this page not working. Also, the problem on the main demo page is regarding the JS command to set the defaultDate "defDate.set('defaultDate', '2015-10-10')". Using attr works just fine.

from flatpickr.

chmln avatar chmln commented on June 18, 2024

I just pushed some changes that should address any issues you might've had.

Check it out, update, and let me know πŸ‘

from flatpickr.

rafaelrenanpacheco avatar rafaelrenanpacheco commented on June 18, 2024

Now it is working πŸ˜„

Thank you very much

from flatpickr.

sergonius avatar sergonius commented on June 18, 2024

I tried using the set method for setting the defaultDate but it is still not working.
I checked the code and found a setDate method, which gives results, but I the format is not what I need (I guess its maybe m.d.Y? when I am going for d.m.Y) so it messes up the calendar.

In short: data attributes work, toFlatpickr.set('defaultDate', '12.12.2012'); does nothing.

from flatpickr.

chmln avatar chmln commented on June 18, 2024

Yes, definitely use self.setDate() for setting dates.
It will set the selected date object, and update the input value as per self.config.dateFormat

from flatpickr.

sergonius avatar sergonius commented on June 18, 2024

Well, I used d.m.Y when I initialised the datepicker, setDate didn't respect that. I got undefined NaN in my calendar and the days and months were flipped.

from flatpickr.

chmln avatar chmln commented on June 18, 2024

I've addressed some issues in the latest release, please try and let me know if the problem persists.

from flatpickr.

palerdot avatar palerdot commented on June 18, 2024

@chmln I think setDate needs to be documented as part of the standard api of flatpickr. This method saved me some time where I have to update the date for an already initialized flatpickr.

Also, destroy() or creating multiple instances for same selector does not work for me as mentioned in #79

from flatpickr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.