voronianski / react-pikaday-component Goto Github PK
View Code? Open in Web Editor NEWUniversal React component wrapper around Pikaday.js datepicker
Universal React component wrapper around Pikaday.js datepicker
Hello!
How I can set name attribute for input tag?
for example:
<div>
<DatePicker
name="INPUT_NAME"
placeholder="Select Date"
format="YYYY/MM/DD"
maxDate={new Date('2020-07-26')}
value={new Date(date)}
onChange={::this.onDateChange}
/>
</div>
README should have a mention about using CSS from pikaday
. I was using this component for the first time and assumed that css would be pulled in by this component, but that wasn't the case.
https://codesandbox.io/s/kkvj3mzlx7
Removing CSS leaves the component unusable.
We encountered an issue while using this library. When filing off changes to value, minDate and maxDate, because of the logic below, when value is being changed, minDate and maxDate are still in old dates. So it was not setting the correctly value of the date.
componentWillReceiveProps(nextProps) {
const newDate = this._getValueLink(nextProps).value;
const lastDate = this._getValueLink(this.props).value;
this._setDateIfChanged(newDate, lastDate);
this._setMinDateIfChanged(nextProps.minDate, this.props.minDate);
this._setMaxDateIfChanged(nextProps.maxDate, this.props.maxDate);
}
For example:
Original: value: 2017-01-01, minDate: 2017-01-01, maxDate:2017-01-31
Changes: value: 2017-02-05, minDate: 2017-02-01, maxDate: 2017-02-28
Actual after changes: value: 2017-01-31, minDate: 2017-02-01, maxDate: 2017-02-28
Because when _setDateIfChanged is triggered, the minDate and maxDate are still the old dates so it couldn't set the new value since it's out of the range, so it picked the largest value in the old range, in this case is 2017-01-31.
I temporarily flip the order in the vendered code like following and it fixed the issue that i'm describing.
this._setMinDateIfChanged(nextProps.minDate, this.props.minDate);
this._setMaxDateIfChanged(nextProps.maxDate, this.props.maxDate);
this._setDateIfChanged(newDate, lastDate);
Component doesn't destory the pikaday object on componentWillUnmount
.
http://esnextb.in/?gist=9046feb70b2230b6f95c3f41ebce064d
Some error, but demonstrates the issue. Inspect the DOM and there will be a new <div class="pika-single ..."></div>
after clicking the toggle twice.
Currently with React 16, this package causes an error from trying to access PropTypes at _react.PropTypes instead of from the new Proptypes package. The latest source code seems to have this update but it is not reflected in the built JS files (index.js or dist/*.js files):
Thanks!
Happens when importing the component. Seems like _react.PropTypes is not defined in index.js
Changes to the minDate and maxDate props are not reflected in the date picker, because the container check prevents the Pikaday object from being recreated:
componentDidUpdate(prevProps) {
// update if container is set
if (!prevProps.container && this.props.container) {
By default the datepicker div present at the first level at the body. But after passing the container which it needs to be shifted to is not working
HI ,
Can you pls add some these properties.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.