Download src/components/ui/calendar.jsx from guisousa/BaseAdmin: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/spaces/guisousa/BaseAdmin/resolve/main/src/components/ui/calendar.jsx
- Command line
-
hf download hf://spaces/guisousa/BaseAdmin/src/components/ui/calendar.jsx
-
curl -L -o calendar.jsx https://huggingface.co/spaces/guisousa/BaseAdmin/resolve/main/src/components/ui/calendar.jsx
801 Bytes
| import React from "react"; | |
| // Shim simples baseado em <input type="date">. | |
| // Props compatíveis: mode, selected (Date), onSelect(date), disabled(date)=>bool, locale (ignorado). | |
| export function Calendar({ selected, onSelect, disabled }) { | |
| const toInput = (d) => (d ? new Date(d).toISOString().slice(0, 10) : ""); | |
| const fromInput = (s) => (s ? new Date(s + "T00:00:00") : null); | |
| const today = new Date(); | |
| const min = disabled ? today.toISOString().slice(0, 10) : undefined; | |
| return ( | |
| <div className="p-3"> | |
| <input | |
| type="date" | |
| className="rounded-xl border px-3 py-2 outline-none focus:ring-2 focus:ring-black/20" | |
| value={toInput(selected)} | |
| min={min} | |
| onChange={(e) => onSelect && onSelect(fromInput(e.target.value))} | |
| /> | |
| </div> | |
| ); | |
| } | |