Questions tagged [react-datetime]
50 questions
13
votes
2 answers
How to clear the value entered in react-datetime?
I am using react-datetime for our calendar control.Now the issue is
that if the user entered an invalid date like 'djfdjfhjkhdf' then in
this control nothing is there to validate.So I decided to write my own
validation function and call that on blur…

Gorakh Nath
- 9,140
- 15
- 46
- 68
8
votes
3 answers
How to get selected date using react-datetime?
I am using react-datetime out of the box.
Right now, I am trying to get the selected date to be saved into my date state.
import DateTime from 'react-datetime';
import '../DateTime.css';
class SomeClass extends React.Component {
render(){
…

Iggy
- 5,129
- 12
- 53
- 87
4
votes
2 answers
Can't apply Css style to React-datetime using className
I am trying to add border-radius: 5px to React-datetime component using className but not working.
E.g:
import ReactDateTime from ‘react-datetime’;
.datetime{
border-radius: 5px;
}
I know that…

Hemadri Dasari
- 32,666
- 37
- 119
- 162
4
votes
2 answers
react-dateTime picker Css not working
I am using react-dateTime Picker. react-datetime picker's css is not working.can any one tell me why it look like.
It looks like this.
and second one this following function is working but css is working.
var yesterday = Datetime.moment().subtract(…

Sweety
- 730
- 2
- 9
- 19
4
votes
2 answers
How to use react-datetime with react + typescript (inside tsx)
react-datetime has a typescript definition file included, but it does not work (for me). From what I can see, the ts definition file exports a different type (ReactDatetime) than what is in actual javascript file (Datetime).
I went ahead and…

miha
- 3,287
- 3
- 29
- 44
3
votes
1 answer
Is it possible to change the timezone of moment object?
I am developing a reactjs application, I want to set timezone to my application.I am using react-datetime package for date and time selection.
My requirement is, My Application need to works with user's selected timezone.
For example, In my profile…

neelima
- 461
- 10
- 25
3
votes
1 answer
react-datetime + open and disableOnClickOutside prop don't work together
I have problem for closing date picker here my code. I am using this npm package
/* eslint linebreak-style: ["error", "windows"] */
/* eslint-disable no-unused-vars */
import React, { Component } from 'react';
import Datetime from…

Ravi Shah
- 843
- 12
- 29
2
votes
1 answer
How to add onChange to react-datetime when using formik?
I am trying to add onChangeformik.handleChange() to the react-datetime but it will not work. getting an error. without the onChange() it will work. but it will not work when there is onChange().
without the formik, it works. but I need to add formik…

Manjitha Ratnayake
- 23
- 4
2
votes
1 answer
react-datetime + set interval in React
I am using react-datetime control for npm package :click here.
In that time picker how should I set Interval. For example I want to set interval in every 5 minutes so first show 0 then 5,10,15 etc. how can I achive this?
I am using look like this…

Ravi Shah
- 843
- 12
- 29
2
votes
1 answer
React.js: disable DateTime when changed to the past
I'm using react-datetime and want to disable anyone from being able to select a date/time in the past as this will send emails that shouldn't appear to have been sent in the past. Documentation shows me how to disable dates before but when I tried…
user6123958
1
vote
1 answer
react-datetime formik validation
I'm using react-datetime compenent in my react-bootstrap form. Formik with Yup is used for validation.
import React from 'react';
import { Container, Form, Button, Alert, Row, Col, InputGroup } from "react-bootstrap";
import…

SM1312
- 516
- 4
- 13
1
vote
1 answer
react-hook-form and react-datetime: How to set the time to moment() from a button
I am using react-datetime inside a react-hook-form
I want the user to easily set the time to current time using a button Immediate. Instead of selecting the current time manually.
I am trying the below
const [currentDateTime, setcurrentDateTime] =…

Santhosh
- 9,965
- 20
- 103
- 243
1
vote
1 answer
react-datetime dropdown has missing styles(css)
I am making a calendar app that whenever someone clicks the input field, it should appear as a dropdown menu and in that dropwdown menu it should let me select the fields. The styles are missing for the dropdown.
This is how it should appear:
This…

Chen
- 281
- 5
- 14
1
vote
1 answer
How set the validation between start date and end date should select with in the 3 years
I am new to react JS, how can I achieve the validation between two date fields in React JS.
for example: End dates should allow to select only within 3 years based on start date.
class MyForm extends React.Component {
constructor(props) {
…

K Kumar
- 131
- 5
- 14
1
vote
1 answer
Display human readable dateTime format in ReactJS
I have react component where I am using useMemo to define table structure. My data is coming via API in DateTime (Web API C#). I tried to use moment to convert date Time format but unable to do so.
current time format without moment …

K.Z
- 5,201
- 25
- 104
- 240