Giter Club home page Giter Club logo

react-pikaday-component's People

Contributors

dbrans avatar goldylucks avatar marcoala avatar olivierguerriat avatar sbussetti avatar stevehanson avatar voronianski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-pikaday-component's Issues

Can i set name attribute?

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>

Date is not being set correctly with minDate and maxDate change

Description

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);

Updating minDate and maxDate doesn't work due to container check

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) {

Container Property is not working

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

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.