MEnf
MEnf

Reputation: 1512

React-Datepicker: showTimeSelect margins not aligning correctly

As the title states, the margins on my react-datepicker's time div look wonky. I'm using the react-datepicker npm package on version 1.2.2 (which should be the latest version of it). I've included the css for it like so in my root component where my app initializes: import "react-datepicker/dist/react-datepicker-cssmodules.css";

My react-datepicker component is wrapped in the semantic-ui-react Form.Field component, however the css on the time picker is still wonky even if I remove this Form.Field from wrapping it.

Here's what my code looks like:

                <Grid.Column>
                  <Form.Field error={!!fieldErrors.date}>
                    <label>
                      Label
                    </label>
                    <DatePicker
                      name="date"
                      selected={fields.date}
                      onChange={onDateChange}
                      showTimeSelect
                      timeIntervals={15}
                    />
                    <InlineError error={fieldErrors.date} />
                  </Form.Field>
                </Grid.Column>

And here's what the UI looks like:

enter image description here

Thank you for your time.

Edit:

Styles

Upvotes: 3

Views: 3443

Answers (1)

Ani Alaverdyan
Ani Alaverdyan

Reputation: 1637

Adding this style worked for me:

.react-datepicker__time-container   .react-datepicker__time  
.react-datepicker__time-box   ul.react-datepicker__time-list {  
     padding: 0; 
}

Upvotes: 2

Related Questions