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.

Language: Days get settled language but months don't

See original GitHub issue

Hi guys, I have an issue I hope you can help. The question is in the title, the settled language is in French, so days are in French but months stay in English. I tried everything I could, I think you guys would be better than me. I’m sure the problem is very simple, but I don’t see it !

The baby coder that I am thanks you a lot !

import React, { Component } from 'react'
import { SingleDatePicker } from 'react-dates'
import moment from 'moment'

moment.locale('fr')

class DatePicker extends Component {
  state = {}

  componentWillReceiveProps (props) {
    if (props.focused) {
      this.setState({focused: props.focused})
    }
  }

  handleChange = (onChange, value) => {
    this.setState({ focused: false }, () => {
      onChange(value)
    })
  }

  render () {
    const { input: { onChange, value } } = this.props

    return (
      <SingleDatePicker
        date={value || null}
        onDateChange={(value) => this.handleChange(onChange, value)}
        focused={this.state.focused}
        onFocusChange={({ focused }) => this.setState({ focused })}
        numberOfMonths={1}
        displayFormat={() => moment.localeData('fr').longDateFormat('L')}
      />
    )
  }
}

export default DatePicker

capture d ecran 2017-04-28 a 19 30 31

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

32reactions
phsantiagocommented, Sep 25, 2017

I’ve a similar problem, solved adding a import 'moment/locale/fr' after moment import

2reactions
majapwcommented, Apr 28, 2017

We need to submit a PR to make this happen! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Long Does it Take to Become Fluent in a Language?
The answer is: it depends. You first need to understand that learning a language never ends. Settle in for a long ride. But,...
Read more >
Selective mutism - NHS
Find out about selective mutism, a severe anxiety disorder that prevents people from speaking in certain social situations.
Read more >
A glossary of terms used in payments and settlement systems
The Committee on Payment and Settlement Systems (CPSS) is publishing this comprehensive glossary of payment system terminology as a reference document for ...
Read more >
Baby cues & baby body language: a guide
Baby body language gives cues to whether babies are tired or hungry, want to play or need a break. Our guide has videos...
Read more >
Workers' Compensation Understanding the Claims Process
To contest a claim, an insurer must notify you and file a notice of controversy with the Board within 18 days after the...
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