question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API change (V2 roadmap)

See original GitHub issue

Currently, as component’s functionality grows, API grows too (as in #21). So maybe it would be an API reconsideration symptom. Maybe we can determine all 3 types of date pickers based on the input value and there is no need for the extra properties. So in this way, we can make API simpler.

Single Date Selection

const [date, setDate] = useState(undefined)

<Datepicker value={date}
            onChange={setDate}  />

Range Date Selection

const [dateRange, setDateRange] = useState({ from: undefined, to: undefined })

<Datepicker value={dateRange}
            onChange={setDateRange} />

Multiple Dates Selection

const [dates, setDates] = useState([])

<Datepicker value={dates}
            onChange={setDates}  />

As the above API suggests we can differentiate between 3 types of date pickers by the type of value property that has been sent to the component.

  • undefined/null: single-day selection
  • { from: undefined, to: undefined }: range-day selection
  • Array: multiple-dates selection

Changes that should be considered in moving from the current API to the suggested API is as follow:

  • replace selectedDay and selectedDayRange with value property (Also there is no need for selectedDays property for multiple-days selection).
  • remove isDayRange property (Also there is no need for isMultiSelectable property for multiple-days selection).

As the suggested API is similar to related HTML tags (e.g. <input type="date"> and <select>) maybe it would be better to use conventional interface for minimumDate and maximumDate which are min and max respectively in HTML <input type="date"> tag. BTW, this is a huge breaking change for the API but I think the simpler API will worth it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Kiarash-Zcommented, Oct 25, 2019

🎉 the package has been renamed and republished!

1reaction
Kiarash-Zcommented, Sep 18, 2019

We will support gregorian date in v2 as well!🎉(actually, it will be version 1! the package will be renamed)

Read more comments on GitHub >

github_iconTop Results From Across the Web

API v2 Support Policy and Roadmap | Recurly Developer Hub
Although we guarantee that new versions of the API will be supported and remain available for at least two years from release, it...
Read more >
Upgrading Your Maps JavaScript API Application from V2 to V3
Overview; Changes in V3 of the Maps JavaScript API; Upgrading Your Application ... By default, v2 uses standard "painted" road map tiles.
Read more >
API Versioning (GA) · Issue #195 · github/roadmap
A versioned API empowers us to give our customers a clear API roadmap with a predictable cadence. In order to build a trusted,...
Read more >
API Versioning: When and How to Do It Successfully
Major versioning changes are ones that implement a breaking change and require mandatory adjustments for new and existing clients. In most API ......
Read more >
Versioning | Docs | Twitter Developer Platform
Along with Twitter API v2, we launched a new versioning strategy that enables developers ... plan to accommodate these changes in their development...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found