How can I get the name of the month in nominative format?
import { format } from 'date-fns';
import { ru } from 'date-fns/locale';
format(new Date(), 'MMMM', { locale: ru }); // июня
How can I get the name like юинь instead of июня?
I was able to find a solution. To get the stand-alone name of the month the LLLL format should be used.
The working code should look like this:
import { format } from 'date-fns';
import { ru } from 'date-fns/locale';
format(new Date(), 'LLLL', { locale: ru }); // июнь
See documentation -> Month (stand-alone): https://date-fns.org/v2.14.0/docs/format
There are a few patterns you can use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With