React-datepicker: Error when using setHours and setMinutes

Created on 26 Mar 2019  路  5Comments  路  Source: Hacker0x01/react-datepicker

I have this:

<DatePicker selected={this.state.startDate} onChange={this.handleChange} showTimeSelect minDate={new Date()} minTime={setHours(setMinutes(new Date(), 0), 7)} maxTime={setHours(setMinutes(new Date(), 0), 17)} filterDate={this.isWeekday} timeFormat="HH:mm" timeIntervals={30} dateFormat="d MMMM, yyyy h:mm aa" timeCaption="Hora" locale="es" />

But setHours and setMinutes throw an error. I am missing something?
Also, with filterDate I want to allow only to select a weekday. Does anyone have the function for isWeekday?

wontfix

Most helpful comment

@no1lov3sme The URL which you shared it's throwing 404.

import setSeconds from "date-fns/setSeconds";
import setMinutes from "date-fns/setMinutes";

Source

All 5 comments

Hi, you need date-fns module for that, take a look at this example.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@no1lov3sme The URL which you shared it's throwing 404.

@no1lov3sme The URL which you shared it's throwing 404.

import setSeconds from "date-fns/setSeconds";
import setMinutes from "date-fns/setMinutes";

Source

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evolve2k picture evolve2k  路  3Comments

pinturic picture pinturic  路  3Comments

lclemence picture lclemence  路  3Comments

ali-master picture ali-master  路  3Comments

dhruvparmar372 picture dhruvparmar372  路  3Comments