Giter Club home page Giter Club logo

persian-date's Introduction

persian-date

A Persian date to convert from gregorian and behavie like a date in Javascript project.

Description

Persian date is a simple, easy-to-use, and fully customizable date picker component for web applications. Whether you need a basic date input or a complex, multi-feature calendar interface, Persian date can be easily integrated into your project.

Installation

Via npm

npm install persian-datepicker

Via yarn

yarn add persian-datepicker

Options

Option Type Default Description
format String MM/DD/YYYY The format in which the selected date will be displayed in the input field.
minDate Date null The earliest date that can be selected.
maxDate Date null The latest date that can be selected.
onSelect Function null A callback function that is triggered when a date is selected. The selected date is passed as an argument.

Basic Example in React

import React, { useEffect } from 'react';
import DatePicker from 'path/to/datepicker.js';
import 'path/to/datepicker.css';

const DatePickerComponent = () => {
  useEffect(() => {
    const datepicker = new DatePicker('#date-picker', {
      format: 'MM/DD/YYYY',
      onSelect: function (date) {
        console.log('Selected date:', date);
      },
    });
  }, []);

  return <input type="text" id="date-picker" />;
};

export default DatePickerComponent;

Explanation:

  1. useEffect Hook: This ensures that the datepicker is initialized after the component mounts.
  2. Import Statements: The DatePicker component and its CSS file are imported at the top.
  3. input Element: The id="date-picker" is linked to the DatePicker instance in the useEffect hook.

This example should help users understand how to integrate the date picker into a React component.

Contact

For more information, feel free to reach out via [email protected] or visit our GitHub Discussions.

persian-date's People

Contributors

muhamadzolfaghari avatar siavashsk avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.