Categories
Programming

Growing in-dependent

As I have been working on independent projects outside of the Web Development course curriculum, I’ve found myself moving away from the school mandated rigor of using only the inbuilt or personally developed functions, methods, and classes, and into the magical world of external libraries.

As you might be aware, JavaScript’s inbuilt Date class leaves much to be desired, even compared with *shudders* PHP. JavaScript’s Date class lacks methods to do what many other languages can, such as outputting a date in a specified format (such as YYYY-MM-DD), or the ability to capture the user’s current time and timezone, and then convert that time to a different timezone. In these cases, these were minor but required aspects of the project, but the code required to accomplish these requirements would take an inordinate amount of extra work for little return.

In these cases, external libraries come to the rescue. When I was searching for how to wrangle Date into behaving how I intended, I turned to every developer’s friend: StackOverflow. Whereby I found fellow developers inquiring the same question, and every top answer to these questions was the same: just use an external library. While there was variation between whether to use Moment.js or Luxon, they all established that trying to play ‘Don Quixote’ against the windmill that is JavaScript’s Date for complex methods is an exercise in futility, and one is better off simply using an external library and saving themselves the pain. Perhaps ES7 will bring changes to the inbuilt methods, but until then, external libraries can very often provide coverage for the deficits and shortcomings in the native language. While external libraries always introduce the risk of disrupting the environment and data architecture, once can take some of the effort that would have been used trying to tackle all this problems intuitively, and instead use a fraction of the effort into researching the various external libraries to ensure that they aren’t unwitting introducing problems.

One reply on “Growing in-dependent”

Leave a Reply

Your email address will not be published. Required fields are marked *