import { DatePane } from "./DatePane" import { TimePane } from "../TimePicker/TimePane" import { createSignal, Show } from "solid-js" import dayjs from "dayjs"; import { Icon } from "../../Icon"; import { useDatepickerContext } from "."; export function DateTimePane (props: any) { const [tab, setTab] = createSignal('date'); const ctx: any = useDatepickerContext(); const val = () => props.store[0].currentMonth[props.name === 'end' ? 1 : 0]; // const val = () => props.value || new Date(); const displayDate = () => { return dayjs(props.value || new Date()).format('YYYY-MM-DD'); } const displayTime = () => { return dayjs(val()).format('HH:mm:ss'); } const selectTab = (tab: string) => { setTab(tab); } const onSelectTime = (type: string, num: number, name: string) => { let v = new Date(val()); if (type === 'hour') { v.setHours(num); } if (type === 'minute') { v.setMinutes(num); } if (type === 'second') { v.setSeconds(num); } ctx && ctx.onSelectTime(v, props.name); } return
{displayDate()}
{displayTime()}
}