-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Over the course of this project, I managed there were a some obstacles that stuck out that were overcome. As well as, some general practices and the extent of the usefulness that were drilled into me.
First, the obstacles. In particular I'd say that the largest issues I ran into were with dates. Both with formatting dates, and comparing dates. Comparing dates was more just 'A lot' than it was difficult and I'm sure that if set my mind to it I could probably find a significantly more efficient method of accomplishing the same task but, for now I've learned that doing pretty much anything with dates is a bit of a pain. I had a little more trouble with formatting, less because I had a difficult figuring out a working method and more because I was trying to figure out a way to have it formatted in the database as well. In the end I was able to just use .toLocaleString and .split().join()
This brings me to the second thing that I learned. Which is just how useful helper functions and middleware can be. I was originally writing certain errors everywhere they were needed, along with manually formatting dates everywhere they were called. When it came to refactoring I created custom middlewares to handle the errors in addition to creating helper functions to format my dates. These few functions/middleware allowed me to remove almost 200 lines of code and dry it up a TREMENDOUS amount.