CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: moment.js

Chuvash localization of moment.js

For three months ago I added Chuvash localization of moment.js. For 16 days ago moment.js 1.7.0 was officially released which included the Chuvash translation.

Wait a sec… What is moment.js?

moment.js is the best datetime tool for javascript. It supports many languages (now even Chuvash) for displaying date and time. Another very handy functionality is showing relative time which has a simple interface: fromNow().

Here is a simple example from a web browser console:

moment().subtract("days", 3).calendar()
//"Иртнĕ вырсарникун 07:30 сехетре"
moment().subtract("days", 3).subtract("hours", 10).calendar()
//"Иртнĕ шăматкун 21:31 сехетре"
moment("2011-10-04", "YYYY-MM-DD").fromNow()
//"10 уйăх каялла"
moment("2012-10-04", "YYYY-MM-DD").fromNow()
//"2 уйăхран"

Previous Issues

UPDATE: It has been released an update of moment.js: 1.7.1 where all of the issues with Chuvash localization are gone.
For Until now there is was one issue with Chuvash localization of moment.js: wrong suffix in future relative time. In most supported languages in moment.js to express something what will happen in future, prepositions (words before, like in, for, by) are used. In the agglunative languages (Basque, Turkish, Korean and Japanese) postpositions (words after) are used. Chuvash is a bit different, the future is expressed by the ablative case.

ikĕ ujăh (2 months) - ikĕ ujăhran (in two months)

Not a big deal, you think? It wouldn’t be if it there wasn’t vowel harmony (front and back vowels):

ikĕ sehet (2 hours) - ikĕ sehetren (in two hours)

Besides vowel harmony the ablative case affix can be ran/ren (after almost all sounds) and tan/ten (after l n r).

ikĕ şul (2 years) - ikĕ şultan (in two years)

For now it is not possible to provide a function for custom logic for future fromNow (like there is such functions for time units: minutes, montsh, years), something like that:

relativeTime : {
	future : function(output) {
		var affix = /сехет$/i.exec(output) 
                     ? "рен" : /çул$/i.exec(output) ? "тан" : "ран";
		return output + affix; 

And the “humanize” function in moment.js has to be able to handle a function as parameter:

humanize : function (withSuffix) {
	var difference = +this,
		rel = this.lang().relativeTime,
		output = relativeTime(difference, !withSuffix, this.lang());
	if (withSuffix) {
		var rt = difference <= 0 ? rel.past : rel.future;
                //was: output = (difference <= 0 ? rel.past : rel.future).replace(/%s/i, output);
		if (typeof rt === 'function') {
			output = rt(output);
		else {
			output = rt.replace(/%s/i, output);
	return output;
Daniel Chronlund Cloud Tech Blog

News, tips and thoughts for Microsoft cloud fans

Вула Чăвашла

VulaCV - Чăвашла вулаттаракан сайт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Architect, Speaker, Author

Microsoft 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Mai Omar Desouki

PFE @ Microsoft

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders


Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant


SharePoint for everyone


Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint


Mostly what I know and share about...