How add time in react-date-range?

I use react-date-range dependency and I'd like to add time How I can do it?
15 Replies
croganm
croganm12mo ago
You can't, it just doesn't support it. You need to find a "date time picker" is what it's called
croganm
croganm12mo ago
Medium
13 React DatePickers and TimePickers for 2020
Useful React components and libraries that save you time when letting users choose their own time.
Nikita
Nikita12mo ago
I found something that I need but its 30 days trial
croganm
croganm12mo ago
Well, you can always build it yourself too! Could also use this
croganm
croganm12mo ago
GitHub
GitHub - flatpickr/flatpickr: lightweight, powerful javascript date...
lightweight, powerful javascript datetimepicker with no dependencies - GitHub - flatpickr/flatpickr: lightweight, powerful javascript datetimepicker with no dependencies
croganm
croganm12mo ago
Just add it with on Mount *useEffect.
Nikita
Nikita12mo ago
Its not exactly what I want but its the best for now How implement it with react? Send codesandbox please
croganm
croganm12mo ago
I'm on mobile, I can't send codesandbox
croganm
croganm12mo ago
npm
react-flatpickr
flatpickr for React. Latest version: 3.10.13, last published: a year ago. Start using react-flatpickr in your project by running npm i react-flatpickr. There are 143 other projects in the npm registry using react-flatpickr.
Jochem
Jochem12mo ago
"Send codesandbox please" comes off really entitled and probably puts people off trying to help, I know it does me. We're not here to write your code or read documentation for you and implement exactly what you want, this channel is intended to help you on your way if you're stuck on something. Some people might make examples of what you want, or write some code for you, but please don't demand people do so
Nikita
Nikita12mo ago
I got you It just would be good Cause I never did something similar A no - once did but it was date-range
Jochem
Jochem12mo ago
The best way to learn is to do, though, so people writing code you can copy/paste isn't as effective if you want to keep asking questions like this, that's fine, it's not against any rules, but I've seen quite a few of your questions get low response, and I'm pretty sure it's at least influenced by "send codesandbox please"
Nikita
Nikita12mo ago
Ok I have some progress https://nn8vds-3000.csb.app/
Nikita
Nikita12mo ago
.input-time {
padding: 1rem 2rem;
font-size: 1.4rem;
border: 1px solid #aaaaaa;
border-radius: 12px;
outline: none;
}

.react-datepicker__navigation {
right: 90px !important;
}

.react-datepicker__day--outside-month {
color: gray;
}
.input-time {
padding: 1rem 2rem;
font-size: 1.4rem;
border: 1px solid #aaaaaa;
border-radius: 12px;
outline: none;
}

.react-datepicker__navigation {
right: 90px !important;
}

.react-datepicker__day--outside-month {
color: gray;
}
import React, { useState } from "react";
import "./styles.css";
import DatePicker from "react-datepicker";

export default function App() {
const [startDate, setStartDate] = useState();
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<DatePicker className="input-time"
selected={startDate}
onChange={(date) => setStartDate(date)}
showTimeSelect
dateFormat="dd.MM.yyyy HH:mm"
/>
</div>
);
}
import React, { useState } from "react";
import "./styles.css";
import DatePicker from "react-datepicker";

export default function App() {
const [startDate, setStartDate] = useState();
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<DatePicker className="input-time"
selected={startDate}
onChange={(date) => setStartDate(date)}
showTimeSelect
dateFormat="dd.MM.yyyy HH:mm"
/>
</div>
);
}
thats for me and others Now I want get date value and change design
Nikita
Nikita12mo ago
When I try it with TypeScript I have no appied styles