PrimeReact Calendar Locale Issue

UI Components for React
Post Reply
ihudson
Posts: 2
Joined: 08 Mar 2018, 02:02

08 Mar 2018, 02:07

Hello!

The PrimeReact Calendar in 1.4.1 is giving me the following error:

Code: Select all

Uncaught TypeError: Cannot read property 'monthNamesShort' of undefined
It seems that this.locale is not getting set anywhere and is undefined. I tried modifying all the uses to instead use this.props.locale and this seemed to work. It seems that it could probably also be solved by assigning this.locale somewhere...

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

14 Mar 2018, 15:04

Unable to replicate, please create a plunker case (https://plnkr.co/edit/uHHN7wKskRgpHszbPZtj?p=preview). Also, you can see "Spanish" in http://primefaces.org/primereact/#/calendar

ihudson
Posts: 2
Joined: 08 Mar 2018, 02:02

22 Jun 2018, 21:18

Hi merve7,

My plunker case is here: https://plnkr.co/edit/ahFrADebHoh1Etj5I48j?p=preview (see App.jsx)

This is related to the dateFormat and inline. When inline is set to true, this is not an issue (you can test this in my plunker).

this.locale is not defined within the formatDate function, and it gets hit when using a dateFormat that includes 'M'.

The other places in Calendar.js use this.props.locale, which uses the default locale. I believe replacing the instances of this.locale with this.props.locale will fix the issue (I proved this out locally for my project).

We also are now running on primereact v1.6.0.

Let me know if you have any questions around this.

peikezot
Posts: 2
Joined: 25 Jun 2018, 17:54

25 Jun 2018, 18:05

I'm having the same problem.
Please note that the same problem exists for the days as well.

peikezot
Posts: 2
Joined: 25 Jun 2018, 17:54

25 Jun 2018, 18:25


mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

26 Jun 2018, 14:36

Fixed for next version.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests