Comments (15)
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.
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:
The datepicker popup does not focus the defaultDate.
Best regards.
from flatpickr.
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.
On Chrome 45, anonymous mode, with cleared cache, the behavior stills the same :(
No console errors as well.
from flatpickr.
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.
Hi, for me the same issue
from flatpickr.
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.
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.
I just pushed some changes that should address any issues you might've had.
Check it out, update, and let me know π
from flatpickr.
Now it is working π
Thank you very much
from flatpickr.
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.
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.
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.
I've addressed some issues in the latest release, please try and let me know if the problem persists.
from flatpickr.
@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)
- parseDate does not throw error for invalid dates when allowInput HOT 1
- Auto-Focus minutes after inserted hours
- Turn off auto close?
- Feature Request: When using altFormat, internally also copy the "style" attribute contents to created element
- valueChange on keyDown in datetime time input HOT 1
- Bug Report: Cannot getDate when using allowInput and allowInvalidPreload
- Bug Report: with altInput & alFormat, the created input does not extract and use all the class names HOT 1
- minDate set via instance.set(), calendar open on second time all dates are disabled
- current month forced to update when showMonths > 1
- Flatpickr does not receive focus if altInput is enabled
- Broken Links npmcdn.com HOT 1
- Documentation points to wrong CDN
- Request for Consideration: Show Current Time when user first clicks to Select Date Time
- when we select startDate and same endDate it only shows startDate in mode range. any solution to this
- Method expression is not of Function type
- [Error] current cdn path is error, HOT 15
- hebrew translation of rangeSeperator is not good
- Inputs with custom placeholder as value throw validation error during opening and closing calendar popup HOT 1
- DefaltDate + 10 days HOT 1
- When βnoCalendarβ is set to false, the dates in June change to July. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flatpickr.