upd: kalender divisi

Deskripsi:
- tambah kalender divisi
- nb : blm selesai

No Issues
This commit is contained in:
2025-07-15 17:41:53 +08:00
parent 0c88ef5bbd
commit cf3b2090ea
4 changed files with 205 additions and 48 deletions

View File

@@ -14,7 +14,7 @@ type Props = {
error?: boolean;
errorText?: string;
required?: boolean;
type: 'date' | 'datetime' | 'time'
mode: 'date' | 'datetime' | 'time'
round?: boolean
width?: number
bg?: 'white' | 'transparent'
@@ -23,12 +23,16 @@ type Props = {
};
export function InputDate({ label, value, placeholder, onChange, info, disable, error, errorText, required, type, round, width, }: Props) {
export function InputDate({ label, value, placeholder, onChange, info, disable, error, errorText, required, mode, round, width, }: Props) {
const [modal, setModal] = useState(false);
const onChangeDate = ({ type }: { type: string }, selectedDate: any) => {
if (type === "set") {
onChange(dayjs(selectedDate).format("DD-MM-YYYY"))
if (mode == "date") {
onChange(dayjs(selectedDate).format("DD-MM-YYYY"))
} else if (mode == "time") {
onChange(dayjs(selectedDate).format("HH:mm"))
}
setModal(false)
} else {
setModal(false);
@@ -56,7 +60,7 @@ export function InputDate({ label, value, placeholder, onChange, info, disable,
modal && (
<DateTimePicker
value={value ? stringToDate(value) : new Date()}
mode={type}
mode={mode}
display="default"
onChange={onChangeDate}
onTouchCancel={() => setModal(false)}