Declination in moment.js
There is a feature in momentjs that allows you to tilt the days. For example, 1 day, 2 days, 5 days. But here's how to do it - I have no idea. I've already searched the documentation. Maybe someone knows?
1
3 answers
Here is the code for this function. But you can't export it, it's local. https://github.com/moment/moment/blob/develop/locale/ru.js#L15
This is a simple function. Just copy this one or take any one from npm at the request of russian pluralize.
3
Author: alexes, 2017-02-06 10:44:43
Maybe it will help someone. There was also a problem with the declination of the month.
date.format('YYYY MMMM D') // месяц - март
date.format('D MMMM') // выводит - марта
The library logic is as follows:
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
3
Author: Kol007, 2017-09-04 11:35:26
Faced the same problem. As a result, in the documentation I found how to implement
moment().from(moment().subtract(4, 'days'), true)
1
Author: Ruslan Melnychenko, 2018-11-16 20:40:36