Narain Sagar
Published in

Narain Sagar

My first ever open source contribution (added sindhi locale support for momentjs)

About Moment:

Parse, validate, manipulate, and display dates in javascript. — via moment.js

Momentjs is one of the best javascript date(s) parsing open source library.

It has over 30k+ github stars and 40k+ github forks.

I (and we — the javascript developers) definitely love moment and use whenever we want to play with date objects and formation.

Nice thing about the moment is that it supports multiple locales, multiple timezones and developers have contributed into it to make it better for everyone around the world.

Few months back, our Team Lead at Recurship (i.e., place at I work) made compulsory for every developer to do one contribution in any open source library each month.

So, I was looking into different libraries on github (their issues, PR’s by others, etc) and got into moment repo and saw their was no locale for Urdu & Sindhi language there. I then found in open PRs that someone already opened Urdu PR so decided to go with Sindhi. Sindhi is one of the language used by many peoples lives in Sindh (Pakistan) and I have heard that it’s been used in India as well.

So, I went through with moment docs, contribution guidelines, etc and setup the moment on my local machine. Writing a moment locale isn’t very difficult though but the most of difficult thing (newbies) developers face is to write unit tests for code they have written. For creating locale we just need to copy any other locale code and have to do the translations and same thing with the unit tests as well. Everything is written there different locales codes along with unit tests.

I just created my PR and here’s now it’s been merged in official moment repository under release v2.18.0

Github PR Link:

It’s just a first attempt, have it a try and let me know your feedback on this and open issues over github moment repo if you find any bug or wrong translation.





Full Stack JavaScript Developer, Currently focusing on Node.js / Angular2 / Koa2 / TypeScript / Loopback

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Narain Sagar

Narain Sagar

Full Stack JavaScript Developer, Currently focusing on Node.js / Angular2 / Koa2 / Loopback