Piumaster | Alejandro Piumetti

React DatePicker - Chakra-UI V2

Nov 21, 2025

“Única” forma de formatear la fecha en Input en Chakra V2.


  import {
  FormControl,
  FormLabel,
  Input,
  } from "@chakra-ui/react";
  import dayjs from "dayjs";
  import DatePicker from "react-datepicker";
    
    //código existente...
            <FormControl>
              <FormLabel>Hasta</FormLabel>
              <Input
                as={DatePicker}
                dateFormat={"DD/MM/YYYY"}
                value={dayjs(endDate).format("DD/MM/YYYY")}
                onChange={(e) => {
                  setEndDate(e);
                }}
                maxDate={dayjs(new Date())}
              />
            </FormControl>

  // Código existente...


Cargando comentarios...

💬 ¿Querés participar de la conversación? Respondé en Mastodon