tulsiojha / nepali-datepicker-react

Nepali Datepicker React is a lightweight, highly customizable, and feature-rich datepicker component, specifically designed for handling Nepali dates in React.js applications. It offers seamless integration, intuitive user experience, and extensive configuration options.
https://nepali-datepicker-react.ojhabikash.com.np/
MIT License
1 stars 0 forks source link

(feature): Option to format a date string. #6

Closed dipbazz closed 3 weeks ago

dipbazz commented 3 weeks ago

There aren't any API to format a date string in provided documentation. I would like to know if it exists and if doesn't then the API to format a date would a grate addition to the package. For now the only formatted date is in form "YYYY-MM-DD" with the API .toString().

Expected Behaviour.

An API .format(formatString) which formats a date based on the string values. We can take an example reference from dayjs format, where the date can be formatted based on the need. For eg:

const neDate = new NepaliDate();
console.log(neDate.format("MMMM DD, YYYY") // should print Karthik 06, 2081
console.log(neDate.format("MMMM D, YYYY, dddd") // should print Karthik 6, 2081, Tuesday
// and so on
tulsiojha commented 3 weeks ago

Hi @dipbazz, Thank you for your feedback!

I am planning on adding this feature on coming weekends.

dipbazz commented 3 weeks ago

Hi @tulsiojha, Once it's completed let me know about the update will be happy to update the package.

tulsiojha commented 3 weeks ago

Hi @dipbazz, I have added date format api to the package. Please update the package to latest version to access this api.

Documentation for reference is here: https://nepali-datepicker-react.ojhabikash.com.np/docs/date-api#format

If you find any bug related to format api, feel free to open new issues.