{"action":"created","issue":{"url":"https://api.github.com/repos/Hacker0x01/react-datepicker/issues/1174","repository_url":"https://api.github.com/repos/Hacker0x01/react-datepicker","labels_url":"https://api.github.com/repos/Hacker0x01/react-datepicker/issues/1174/labels{/name}","comments_url":"https://api.github.com/repos/Hacker0x01/react-datepicker/issues/1174/comments","events_url":"https://api.github.com/repos/Hacker0x01/react-datepicker/issues/1174/events","html_url":"https://github.com/Hacker0x01/react-datepicker/issues/1174","id":281612729,"number":1174,"title":"Unable to initialize custom input with empty date (selected = null)","user":{"login":"yangtheng","id":29228248,"avatar_url":"https://avatars2.githubusercontent.com/u/29228248?v=4","gravatar_id":"","url":"https://api.github.com/users/yangtheng","html_url":"https://github.com/yangtheng","followers_url":"https://api.github.com/users/yangtheng/followers","following_url":"https://api.github.com/users/yangtheng/following{/other_user}","gists_url":"https://api.github.com/users/yangtheng/gists{/gist_id}","starred_url":"https://api.github.com/users/yangtheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangtheng/subscriptions","organizations_url":"https://api.github.com/users/yangtheng/orgs","repos_url":"https://api.github.com/users/yangtheng/repos","events_url":"https://api.github.com/users/yangtheng/events{/privacy}","received_events_url":"https://api.github.com/users/yangtheng/received_events","type":"User","site_admin":false},"labels":[{"id":325098149,"url":"https://api.github.com/repos/Hacker0x01/react-datepicker/labels/needs%20more%20info","name":"needs more info","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-12-13T03:21:41Z","updated_at":"2017-12-26T03:40:37Z","closed_at":null,"author_association":"NONE","body":"I want to make two date drop downs with departing and returning date for flights. I want my system to identify that if returning date is empty it is assumed that the user is looking for a one way flight. However I am able to render the datepicker if I do not pass a moment date object to selected:\r\n\r\n` <div style={{display: 'inline-block', width: '25%'}}>\r\n<DatePicker customInput={<CustomDatePicker flight />} selected={this.state.departureDate} dateFormat={'DD MMM YYYY'} minDate={moment(this.props.dates[0])} maxDate={moment(this.props.dates[this.props.dates.length - 1])} onSelect={(e) => this.handleChange(e, 'departureDate')} />\r\n          </div>\r\n          <div style={{display: 'inline-block', width: '25%'}}>\r\n            <DatePicker customInput={<CustomDatePicker flight />} selected={this.state.returnDate} dateFormat={'DD MMM YYYY'} minDate={moment(this.props.dates[0])} maxDate={moment(this.props.dates[this.props.dates.length - 1])} onSelect={(e) => this.handleChange(e, 'returnDate')} />\r\n          </div>`\r\n\r\nand state is initialized with: \r\n\r\n`     departureDate: moment(new Date(this.props.date)),\r\n      returnDate: null,`\r\n\r\nI have tried various values for return date including {} and '', both does not work in my case."},"comment":{"url":"https://api.github.com/repos/Hacker0x01/react-datepicker/issues/comments/353912566","html_url":"https://github.com/Hacker0x01/react-datepicker/issues/1174#issuecomment-353912566","issue_url":"https://api.github.com/repos/Hacker0x01/react-datepicker/issues/1174","id":353912566,"user":{"login":"yangtheng","id":29228248,"avatar_url":"https://avatars2.githubusercontent.com/u/29228248?v=4","gravatar_id":"","url":"https://api.github.com/users/yangtheng","html_url":"https://github.com/yangtheng","followers_url":"https://api.github.com/users/yangtheng/followers","following_url":"https://api.github.com/users/yangtheng/following{/other_user}","gists_url":"https://api.github.com/users/yangtheng/gists{/gist_id}","starred_url":"https://api.github.com/users/yangtheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangtheng/subscriptions","organizations_url":"https://api.github.com/users/yangtheng/orgs","repos_url":"https://api.github.com/users/yangtheng/repos","events_url":"https://api.github.com/users/yangtheng/events{/privacy}","received_events_url":"https://api.github.com/users/yangtheng/received_events","type":"User","site_admin":false},"created_at":"2017-12-26T03:40:37Z","updated_at":"2017-12-26T03:40:37Z","author_association":"NONE","body":"The example does not use a custom input. I have just tried removing the custom input from my own component and selected=null works. However, why does it not work with custom input?\r\n\r\nAnyway, this is the component I am using for the customInput prop:\r\n`class CustomDatePicker extends Component {\r\n  render () {\r\n    return (\r\n      <span\r\n        key='datePicker'\r\n        onClick={this.props.onClick}>\r\n        {this.props.value}\r\n      </span>\r\n    )\r\n  }\r\n}`\r\n\r\nI was just following the example from https://hacker0x01.github.io/react-datepicker/ but with <span> instead because I do not want a button."}}
{"actor":{"display_login":"yangtheng"}}