1

Hi how can I use https://momentjs.com/docs/#/i18n/ in react native ? I exactly need to know how to change the language on my calendar.

Now I have name mounths in Polish but name days I have in english but I nedd Polish.

  import momentPL from 'moment/src/locale/pl' 



    function TermeScreen({ route, navigation }) {
      const { id, title } = route.params;
      const [selectedDate, setSelectedDate] = useState(new Date());
    
      moment.locale('pl',momentPL );
      let startDate = moment() 
Dev007
  • 366
  • 1
  • 12

1 Answers1

1

Try this,

import moment from 'moment';

function TermeScreen({ route, navigation }) {
  const { id, title } = route.params;
  const [selectedDate, setSelectedDate] = useState(new Date());

  let startDate = moment(selectedDate.format("YYYY-MM-DD");
}
Shivam
  • 2,147
  • 1
  • 11
  • 28
  • I need change name day and mounths from English to Polish langue – Dev007 Oct 19 '22 at 11:17
  • 2
    https://stackoverflow.com/questions/17493309/how-do-i-change-the-language-of-moment-js#:~:text=You'd%20need%20to%20add,that%20locale%20format%20in%20moment. follow this – Shivam Oct 19 '22 at 11:21
  • Now I have name mounths in Polish but name days I have in english but I nedd Polish. – Dev007 Oct 19 '22 at 11:33