question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change calendar system to Jalali canendar

See original GitHub issue

I want to user react-dates as a Persian datepicker. Persians use another calendar system that called jalali calendar. We have a popular library called moment-jalaali that works perfectly as a moment plug-in. Now my question is that: How we can use jalali calendar system with react-dates? I try below code, but it’s just change locale and strings not entire calendar system.

import React, { Component } from 'react';
import './App.css';
import moment from 'moment-jalaali';
import { DateRangePicker, SingleDatePicker, DayPickerRangeController } from 'react-dates';
import 'react-dates/lib/css/_datepicker.css';

class App extends Component {

  render() {
    moment.loadPersian(); // >>>>>>>>>> This change locale to Persian successfully but how to change calendar system?
    return (
      <div className="App">

        <SingleDatePicker
          date={moment()}
          onDateChange={date => console.log(date)} // PropTypes.func.isRequired
        focused={true}
          onFocusChange={({ focused }) => console.log(focused)} // PropTypes.func.isRequired
        />

      </div>
    );
  }
}

export default App;

This is output screen shot for above code you can see that calendar system is wrong: jalali_1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
mpourismaielcommented, Jun 7, 2017

renderMonth and renderDay fixes the locale problem but the issue with the calendar itself still stands.

calendar

First of the month in the calendar is marked 11, which is 11th of the respective month in Jalali while it should obviously be 1. Am I missing something?

4reactions
ImanMhcommented, Jun 19, 2017

Sounds grate, if this issue is fixed many more people will start replacing their code with this date picker. Please notify people at this thread if this issue is fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change calendar system to Jalali canendar #447 - GitHub
I want to user react-dates as a Persian datepicker. Persians use another calendar system that called jalali calendar.
Read more >
Jalali calendar - Wikipedia
However, the original Jalali calendar based on observations (or predictions) of solar transit would not have needed either leap years or seasonal adjustments....
Read more >
Can Forms be customized to support Jalali Calendar in the ...
One of our prospective customers want to use this Jalali (Persian) calendar. I changed the NLS_CALENDAR for the session to Persian and this...
Read more >
Set Jalali Calendar as system date or ... - Ubuntu Mailing Lists
Previous message: Set Jalali Calendar as system date or ... Next message: default configuration issue in teeworlds 0.4.2.1... Messages sorted by ...
Read more >
Gregorian < > Persian Calendar Converter
The Persian Calendar Converter can convert from any date according to the Gregorian Calendar into a date according to the Persian or Iranian...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found