import { onMount } from "solid-js"

import utils from "../utils";

import "./laydate.css"

function laydateRender(props) {
    const time = utils.getTime();
    onMount(() => {
        laydate.render({
            elem: "#" + props.id,
            range: true,
            format: "yyyy/MM/dd",
            value: [
                `${time.year}/${time.month}/${time.day}`,
                `${time.year}/${time.month}/${time.day}`
            ].join(' - '),
            max: `${time.year}/${time.month}/${time.day}`,
            theme: '#1db7b6'
        });
    })
    return <div className="back">
        <i className="icon iconfont">&#xe637;</i>
        <input className="layui-input" style={'width:' + props.width} id={props.id} type="text" placeholder="开始日期 - 结束时间" />
    </div>
}

export default laydateRender;
