Single and Range Date picker in react - reactjs

I need a React Datepicker which allows to pick both single, multiple and range dates together.
For example, I need to choose 05-03-2022 and 06-03-2022, 10-03-2022 to 12-03-2022, 20-03-2022 to 30-03-2022. I have tried many multi-datepickers but all are allows any one option i mentioned but not all together.
Is there any React Datepicker to achieve this?
Need your valuable help.

Related

How to create ssr in reactjs

I'm trying to code a date picker using ReactJS but I don't know how to create a dynamic table that displays the actual month days every time I hit previous or next buttons. Here's my code: // Next step I need to add a matrix of weekdays (1..31) and check each month existing ...
I wouldn't reinvent a wheel unless it's unavoidable.
There are multiple date pickers that can be used out of the box:
E.g.:
https://www.npmjs.com/package/react-date-picker
https://www.npmjs.com/package/react-datepicker
https://react-day-picker.js.org/
But that's only if you just need any picker. If you must create a custom one, then this doesn't help.

Redux-form and react-datepicker - how to differentiate presented value format in the input and real value format?

I use Redux Form and react-datepicker
It works very nice, and I would like to get it work ideally according to my needs.
I need to show the date in localized format (let's say DD/MM/YYYY), and in the same time save value attribute of the input in static format ("YYYY-MM-DD").
I could add a hidden input with such value format, but if it's possible to avoid it using datepicker customization, it would be great!
Thanks for your advice in advance.
UPD:
Take a look on screenshots:
This is how it works now (nothing has to be changed here).
And value is synchronized with the locale. I want to keep the locale to present my date in the locale format for the user, and keep the format unchanged ("YYYY-MM-DD" forever) for the back end.
Here is the link to codesandbox.
You can use state and moment.js package to have date in several formats.
EDIT: the key thing is redux form. Datepicker is just view that can show exactly what you need. So, what you can do is: change redux form field value (or what you are using) and just have another state field (let's say 'dateForDatepicker') which value you'll pass to datepicker.
GOOD SOLUTION: https://stackoverflow.com/a/42726079/7479959

How to change slider range on chart load

I am working on anychart investment portfolio dashboard
anychart investment portfolio dashboard .
How i can minimize date range of slider for one month only(on chart load) and it should be resizable.
Use selectRange method:
You can specify given dates: http://playground.anychart.com/api/7.12.0/charts/anychart.charts.Stock.selectRange-plain
Specify some interval from the start or end using anchors:
http://playground.anychart.com/api/7.12.0/charts/anychart.charts.Stock.selectRange_set_asUnit-plain
Or use preset range types:
http://playground.anychart.com/api/7.12.0/charts/anychart.charts.Stock.selectRange_set_as_Type-plain
Easy sample showing this for "one month only":
chart.selectRange("MTD");
Is here: http://jsfiddle.net/97kc1jpw/
As for sample itself, we decided it is a good idea to upgrade it, use the latest version and add the option you describe right in it, along with a new nice range selector, please pull the latest changes from https://github.com/anychart-solutions/investment-portfolio-dashboard
You are interested in this particular line: Line 313 in dashboard.js

displaying two months in angular datepicker

I want to have a date picker which displays 2 months calendar at a time in angular. want the one like in this. Please suggest how to implement that in angular
The angular-daterangepicker from fragaria seems to match the requirements here.
There is a live demo of the picker here, just click on the date-range in the upper right corner to see it in action.
Datetime Range Picker is a good option too. Additionally, it has the time component.
http://rgkevin.github.io/datetimeRangePicker/#/home
i need use this for angular 2+ (in angular-material).
possible ?

EXTJS: Month/Day Selector (ie. no year)

I am currently using a EXTJS EditorGridPanel in my application, and for one of the column inputs I require the user to be able to pick a month and day (no year).
I am currently using a DateField to do this, but I need to be able to disable the "year" aspect of it in the UI. I do not care if the "value" in the end has a year associated with it, I can simply disregard it. I have searched to see if anyone has done such a thing, but my only findings are people that way to show only Month/Year.
My other option is to create my own custom input (with comboboxes for month and day, where the day combo changes based on the month), however, I honestly don't have all that much time to make one myself as I would have to go through the learning curve since I have never created a custom input extension before.
--> So my big question then is, has anyone heard of an existing EXTJS month/day picker?
Any help would be much appropriated stack overflow peoples!
Although I would probably create my own custom component to use as the editor, if you're not comfortable doing that, have you considered breaking the Month and Day fields into separate columns in your grid column model?
Another option would be to add a input mask to the textfield (you'll need to specify one as a customEditor in your cm). I believe this is done via custom vtypes. This input mask would force the user to enter the date in the format that you specify.
Using this approach would :
keep all month/day data in one column
simplifies your UI code by using the out-of-the-box components. (IMO this is key for learning ExtJS)
try this one
picker: {
slotOrder: [ 'month', 'day' ]
}
Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.
Try something like:
{
xtype: 'datepickerfield',
name: 'OrderDate',
label: 'Order Date',
picker: { yearTo: 2011, yearFrom: 2020 }
}
I hope this will help you.

Resources