Git Product home page Git Product logo

zaman's Introduction

Zaman

Zaman is a lightweight React component for creating a Jalali/Georgian datepicker. There is also a range datepicker and timepicker in Zaman. The module can also be customized to match the appearance of your designs.

Design

I appreciate Ali Samandar's design of this library. Give him your support.

check out the codesandbox link.

Install

with npm

$ npm i zaman

with yarn

$ yarn add zaman

Props

Date Picker and Calendar

props type default
defaultValue timestamp | Date | Dayjs undefined
weekend number[] undefined
round string one of thin | x1 | x2 | x3 | x4 thin
accentColor string #0D59F2
locale string one of fa | en fa
direction string one of rtl | ltr rtl
onChange function undefined
range boolean false
from timestamp | Date | Dayjs undefined
to timestamp | Date | Dayjs undefined
show boolean false
inputClass string null
inputAttributes object of InputHTMLAttributes null
className string null
customShowDateFormat string ex: YYYY MMMM DD or DD/MM etc. undefined
position right | left | center right

Calendar Provider

props type default
round string one of thin | x1 | x2 | x3 | x4 thin
accentColor string #0D59F2
locale string one of fa | en fa
direction string one of rtl | ltr rtl
children ReactNode null

Time Picker

props type default
defaultValue timestamp | Date | Dayjs Date
round string one of thin | x1 | x2 | x3 | x4 thin
accentColor string #0D59F2
locale string one of fa | en fa
clockTime number one of 12 | 24 24
inputClass string null
inputAttributes object of InputHTMLAttributes null

Usages

Date picker

import { DatePicker } from "zaman";

function App() {
  return (
    <DatePicker onChange={(e) => console.log(e.value)} />
  )
}

Range date picker

import { DatePicker } from "zaman";

function App() {
  return (
    <DatePicker onChange={(e) => console.log(e.from, e.to)} range />
  )
}

Calendar

import { Calendar, CalendarProvider } from "zaman";

function App() {
  const [calendarValue, setCalendarValue] = useState(new Date())

  return (
    <CalendarProvider>
      <Calendar
        defaultValue={calendarValue}
        onChange={(e) => setCalendarValue(new Date(e.value))}
      />
    </CalendarProvider>
  )
}

Time picker

import { TimePicker } from "zaman";

function App() {
  return (
    <TimePicker
      onChange={(e) => console.log(e.hour, e.minute, e.timeConvention)}
    />
  )
}

License

MIT License

zaman's People

Contributors

amirrezamahyari avatar dependabot[bot] avatar immorez avatar malekeym avatar mehdiraized avatar mehrad77 avatar rzkhosroshahi avatar themasix avatar zmashhadizadeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zaman's Issues

Inline Support

Hey Guys,
Thank you for your well-made component.
I have a question:
Does it support inline widget?

Change Months Names

Hello ๐Ÿ‘
I need to change months names as my country needs how I can do it? any solution?
thanks for your good package ๐Ÿ’ฏ

Change year

I need to change year, for example I need to choose year 1380,

Clickable year and month!

Hi,
Thanks for your up-to-date and beautiful component.
Please add the ability to click and select the month and year.

timePicker Minute

timePicker
when u want choosing minute , it must be a value from 0 to 59 , but timePicker allow user choose 60 .

codeSandBox
use codesandbox.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'sand box'
  2. Click on 'timePicker'
  3. Scroll down to 'try to choose a time'
  4. See the error

Expected behavior
we Expect to , limit user to choosing minute from 0 to 59
Screenshots
If applicable, add screenshots to help explain your problem.

**Desktop **

  • Version [2.0.3]

Modal Problem in relative boxes

Hi,
In my idea , this issue caused by not following some standards on designing the DOM of modal.
You provided an absolute and flex modal in your component.
It should be appear at the end of body tag , as other overlays that provided by others(that i mentioned it a a standard).
It causes that your absolute overlay depends on body but with your design , it appears where it React tag inserts. If the parent of it would be a box(div or ...) with style "position : relative" it doesn't depend on body dimensions and relative box limits it.

As the summary , it's better that you make changes to make overlay DOM at the end of body to solve this problem.

With love and thanks a lot !

how can set deafult value ?

hi ,
how can i set a default Value for showing in input ? or set null default value for input ?

sorry about my eng .. ):

Change month and next/prev month issue

Describe the bug
When you change the month and year and go to the next/previous month, it will be the next month from the initial date, not the new one.

To Reproduce
Steps to reproduce the behavior:

  1. Go to calendar/date picker
  2. Click on Year Month
  3. select 1402
  4. select Mordad
  5. click on next month

Expected behavior
After the above steps, the month should be Ordibehst 1402

Desktop (please complete the following information):

  • Version 2.0.3

Custom Input component

The datepicker component has a simple input element without any style and the only option for customizing its style is passing the inputClass prop, which is good, but if they use design systems such as Mui or maybe a custom design system, it will be challenging to maintain and make things look the same.

Customize DatePicker Placement using Prop

Currently, the DatePicker component in our project follows a default placement, which may not always align with specific requirements.

The proposed enhancement must add a new prop, such as position, to the DatePicker component. This prop will accept various values to determine the desired placement of the DatePicker, including "center", "left", "right", or any combination thereof.

How to not selected date?

Describe the bug
I need the default value is null or empty string, and not show any date in datepicker input.
now if not set default value or set null or empty, show first date.

month change

Hi Reza,

When the month is changed and a new day is chosen, onChange (Calendar's Props) does not perform the callback.

Can you help me?
tnx

ERROR. in the link preview

Hi. I see an issue in link preview (data-picker preview)

You see an error about routing when load pages and don't see data-picker when resolve this error

The error:
Capture

The page when solved the error
display

Hot to customize datepicker?

I've installed this package, but I didn't find any prop to change theme or disable unnecessary buttons like time picker (watch popup). Where can I find theme names lists or resize the font-size?
Thanks

how to remove clock from date picker?

Hello, I disable the time picker prop but the clock button is still under the date picker and it causes an error in my code. how can I remove the clock button from my date picker?

Issue found on mobile devices

Dear Developer,

I am writing to report a bug that I have found in this awesome repository. Specifically, I am encountering an issue with the React datepicker module not selecting the correct date on phone displays. When I attempt to select a date using the datepicker on my mobile device, the calendar popup displays but the selected date is either not updated or is updated incorrectly. This issue is occurring consistently on multiple devices and on multiple screen sizes and only on phone size display.

I have attempted to troubleshoot this issue by checking the code for any errors or missing dependencies, but have been unable to identify a specific root cause. Additionally, I have tested the code on multiple devices with different screen sizes and resolutions, all of which are experiencing the same issue.

I would appreciate your assistance in resolving this issue as soon as possible, as it is impacting the functionality and performance of the application. Please let me know if you require any additional information or if there are any specific steps you would like me to take in order to help diagnose and repair the bug.

Thank you for your attention to this matter.

Disable Keyboard when component opens on mobile.

Hello. When I open the component by clicking the Date box, the Mobile Keyboard will opens too! It's a bug I think. Although you use an input to show the date that have picked, but you should disable the keyboard when date box is opened.

how to add attribute to compiled input

Hi. I wanna use this datepicker with Final Form in React. Final Form Field needs to have attr 'name' and I have to add name prop to to be able to get data from input.
How can I do that?

Thanks

how to access themes

how can have different themes of this component .what are values for prop theme?

onChange event on CalendarProvider range

hi, thanks a lot for stunning jalali date picker library.
CalendarProvider range is more beautiful than select range by click on input so we preffered to use your CalendarProvider instead of DatePicker range, by the way you also provide an example like what i said on codesandbox :

<CalendarProvider locale="fa" round="x4" accentColor="#6374ae">
  <Calendar
    defaultValue={new Date()}
    onChange={(d) => console.log(d)}
    weekends={[6]}
    from={new Date()}
    to={new Date().setDate(new Date().getDate() + 7)}
    range
  />
</CalendarProvider>

but i think there is an issue that onChange event only returns first selected date but i hope when we proped range, onChange returns both date started and date ends, some thing like usual way that select date ranges works

<DatePicker onChange={(e) => console.log(e.from, e.to)} range />

how we can use CalendarProvider to get full range dates?

by the way is it possible to use this as one date click then select date range from clicked date till today?

issue: change month and year caused firing onChange event

Describe the bug
During the selecting month and year onChange event is firing.

Expected behavior
The onChange method should be called only when day is selected.

Desktop (please complete the following information):

  • Version 2.0.4

calender doesn't close

after we pick our date the input focuses again and doesn't let the calender to close.

onChange returns wrong Date

value argument that received from onChange call back function is returning the last selected date and it's not correct ๐Ÿ‘Ž๐Ÿผ

Feature Request

Is there a possibility to add this features ?

  1. Changing to Gerorgian (even during the selection in range date picker.)
  2. Showing two month as a prop for better UX.

Thanks a lot.

set custom theme

Hello . how can i define my custom theme at 'theme' attribute . can you show me an example . thanks

Disable Time from DatePicker

Hello. Thanks for developing this awesome component.
But It's documentation and the capability to customize the functionality is BAD!
I want to disable the time from DatePicker component. How could I do that?

delete unnecessary filed in build

Hello, please delete unnecessary files such as .idea, cypress, and other files from the bundled package. it's too large for a datepicker

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.

Hello
After using it in the project, I receive a web pack error
I think it's because the packages used are old
Please take action to resolve this issue
thank you

Compiled with problems:X

ERROR in ./node_modules/jalali-react-datepicker/dist/index.module.js 2:0-23

Module not found: Error: Can't resolve 'stream' in 'C:\files\projects\messenger-dashboard\node_modules\jalali-react-datepicker\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "stream": false }

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.