Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react-datepicker

// npm install react-datepicker --save


import React, { useState } from 'react'
import './App.css'
import DatePicker from 'react-datepicker'
import 'react-datepicker/dist/react-datepicker.css'

function App () {
  const [selectedDate, setSelectedDate] = useState(null)
  return (
    <div className='App'>
      <DatePicker
        selected={selectedDate}
        onChange={date => setSelectedDate(date)}
        placeholderText={'dd/mm/yyyy'}
        filterDate={date => date.getDay() !== 6 && date.getDay() !== 0} // weekends cancel
        showYearDropdown // year show and scrolldown alos
        scrollableYearDropdown
      />
    </div>
  )
}

export default App
Comment

react datepicker

npm install react-datepicker --save
Comment

react-datepicker

npm install react-datepicker --save
Comment

react date picker

import { registerLocale, setDefaultLocale } from  "react-datepicker";
import es from 'date-fns/locale/es';
registerLocale('es', es)

<DatePicker
  locale="es"
/>
Comment

react datepicker documentation

() => {
  const [startDate, setStartDate] = useState(new Date());
  return (
    <DatePicker selected={startDate} onChange={(date) => setStartDate(date)} />
  );
};
Comment

react-datepicker

() => {
  const [startDate, setStartDate] = useState(new Date());
  const MyContainer = ({ className, children }) => {
    return (
      <div style={{ padding: "16px", background: "#216ba5", color: "#fff" }}>
        <CalendarContainer className={className}>
          <div style={{ background: "#f0f0f0" }}>
            What is your favorite day?
          </div>
          <div style={{ position: "relative" }}>{children}</div>
        </CalendarContainer>
      </div>
    );
  };
  return (
    <DatePicker
      selected={startDate}
      onChange={(date) => setStartDate(date)}
      calendarContainer={MyContainer}
    />
  );
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: what is const in javascript 
Javascript :: array.sort 
Javascript :: tutorial of machine learning js 
Javascript :: what does json.parse do 
Javascript :: vuetify use selected value 
Javascript :: redux action creators 
Javascript :: set meterial icon color change onClick react 
Javascript :: new function in javascript 
Javascript :: Uncaught TypeError: $(...).datatables is not a function 
Javascript :: Map put() method 
Javascript :: history react router 
Javascript :: query selector element with class and parent class 
Javascript :: check if jwt token is valid 
Javascript :: run javascript in atom 
Javascript :: angular post data not sending 
Javascript :: pass function with parameter as prop 
Javascript :: big.js 
Javascript :: airbnb react native eslint 
Javascript :: byte array to json 
Javascript :: binance js 
Javascript :: search for diff in two JSON 
Javascript :: js detect end of array 
Javascript :: hasownproperty.call 
Javascript :: jsonl parser javascript 
Javascript :: datatables add row with id 
Javascript :: what does onchange do in react 
Javascript :: js push multiple arguments 
Javascript :: for ... of ... 
Javascript :: anonymous functions in javascript 
Javascript :: max array 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =