Image by captcreate — CC BY-NC-ND 2.0

Devlog 1.2

Just a quick note to follow on from my previous article concerning devlog: I’ve made it a bit better.

Just a bit.

Locale Dates

It now uses your operating system’s locale to produce the date & time stamp. I thought that because Node has the Date.prototype.toLocaleString() method, that dates would print correctly for everyone. Coincidentally, when I was testing the date functionality, it was December 12, so the date 12/12/2016 looked like it was working. It wasn’t until I added more log entries that I noticed the date was printing in mm/dd/yyyy format. As an Australian, this was not acceptable (dd/mm/yyyy FTW)!

Upon investigation, I discovered that Node does not ship with the localisation library required to support locales other than the default (US) locale. Bummer. So after researching many different Date libraries, I settled on using Moment.js as it had the most comprehensive set of locales. I was trying not to use it as it is quite a large dependency, but all the alternatives lacked good locale support.

Printing & Help

You can now type devlog -? to see a list of available commands. devlog -p prints your log file from oldest-entry-to-newest. devlog -pr does the reverse.

As these changes are backwards compatible, the version changed to 1.2.0. (I love semantic versioning :)

Last-but-not-least, test coverage has been improved to 84% (up 18.6%).

As always, your feedback is most welcome. Happy New Year!