Closed Laxman980 closed 4 months ago
hi @Laxman980, it seems you are working with javascript. So, please remove all type definitions and it should work. In above code there is type defined in onChange={(value: string) => setDate(value)}
it should be onChange={(value) => setDate(value)}
Sample working code for JavaScript:
import React, { useState } from "react"
import { NepaliDatePicker } from "nepali-datepicker-reactjs"
import "nepali-datepicker-reactjs/dist/index.css"
const App = () => {
const [date, setDate] = useState("")
return (
<form>
<label htmlFor="date">Date</label>
<NepaliDatePicker inputClassName="form-control"
className=""
value={date}
onChange={(value) => setDate(value)}
options={{ calenderLocale: "ne", valueLocale: "en" }} />
</form>
)
}
export default App
import { NepaliDatePicker } from "nepali-datepicker-reactjs" import "nepali-datepicker-reactjs/dist/index.css" export default function Creatpost()
{ const [date, setDate] = useState("")
}
<NepaliDatePicker inputClassName="form-control"
className=""
value={date}
onChange={(value: string) => setDate(value)}
options={{ calenderLocale: "ne", valueLocale: "en" }} />