react-datetime icon indicating copy to clipboard operation
react-datetime copied to clipboard

Add a defaultTime prop

Open shawninder opened this issue 7 years ago • 13 comments

I'm Submitting a ...

[ ] Bug report
[x] Feature request
[ ] Support request

Steps to Reproduce

Add a defaultTime prop to the element

<ReactDateTime
  dateFormat="YYYY-MM-DD"
  timeFormat="HH:mm:ss"
  defaultTime="23:59:59"
/>

Expected Results

When clicking on a day in the calendar, if defaultTime is set, the datetime obtained should show the provided default time (in my example above: "23:59:59") instead of "00:00:00" as it currently does

Actual Results

Nothing, hence the feature request

Why?

I am using this component to make a DateTime range picker and I'd like the default times to be "00:00:00" for the "From" input, but "23:59:59" for the "To" input, yet I need the defaultValue to be undefined since I want to support open-ended ranges. Such a new feature would make this use-case really easy:

<label>FROM:</label>
<ReactDateTime
  dateFormat="YYYY-MM-DD"
  timeFormat="HH:mm:ss"
/>

<label>TO</label>
<ReactDateTime
  dateFormat="YYYY-MM-DD"
  timeFormat="HH:mm:ss"
  defaultTime="23:59:59"
/>

shawninder avatar Aug 14 '17 21:08 shawninder

+1

k-zaher avatar Aug 18 '17 14:08 k-zaher

I made a PR for this: https://github.com/YouCanBookMe/react-datetime/pull/404

shawninder avatar Aug 18 '17 20:08 shawninder

i'd love to see this implemented. defaultValue doesn't fit my needs either.

rsl avatar Feb 22 '18 18:02 rsl

I would love this as well.

andyboen avatar Jul 11 '18 15:07 andyboen

+1

omkar-joshi avatar Feb 07 '19 10:02 omkar-joshi

+100

dep-deprecated avatar Apr 25 '19 13:04 dep-deprecated

+1

lchangdev avatar Sep 21 '19 21:09 lchangdev

+1 Same case with date range

michaeldybal avatar Oct 02 '19 09:10 michaeldybal

+1

amjad-r-a avatar Oct 22 '19 18:10 amjad-r-a

+1

vebaspect avatar Nov 22 '19 12:11 vebaspect

+1

Jenny4831 avatar Dec 18 '19 00:12 Jenny4831

initialViewDate property could be used to achieve the desired effect.

sneas avatar Oct 07 '20 11:10 sneas

+1

CarlosPhilipe avatar Jun 23 '21 22:06 CarlosPhilipe