react-datetime
react-datetime copied to clipboard
Add a defaultTime prop
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"
/>
+1
I made a PR for this: https://github.com/YouCanBookMe/react-datetime/pull/404
i'd love to see this implemented. defaultValue doesn't fit my needs either.
I would love this as well.
+1
+100
+1
+1 Same case with date range
+1
+1
+1
initialViewDate
property could be used to achieve the desired effect.
+1