Ask me anything
For whatever reason, I find date-time comparisons to be really difficult. I find timezones issues to be confusing. Worst of all, I find comparing ranges of time to be beyond my capacity for visualization. Its because of this that I have repeatedly needed a library in multiple languages to tell me if date-time ranges are equal, overlap, or contain each other.
The output of adding dateranges together is an array of dateranges with a length of 1 to the length of the input array. This is because any overlapping dateranges create a single range in the add operations.
The output of subtracting one daterange from another is an array of dateranges with a length of 0 to 2. This is because the difference could remove none of the original, all of the original, the head of the original, the tail of the original, or it could remove the middle of the original creating two different ranges.
Daterange is not meant to compete with something like moment, its a simple standalone library that is fast, small, and easy to use.
Daterange is available on npm and bower, see GitHub for details.
Do you have a logo? Do you have a head shot? Press kit? What do you do when someone needs that stuff from you, do you send it to them in an email? Get that stuff on your website.
I can’t tell you how often this is a pain point for designers and developers.
And if someone really needs your logo or head shot, and they can’t get a good one, they are going to get a crummy pixelated jpg from the top left corner of your website or your Facebook page.
You’ve been warned. Upload it now.
There are a couple basic things about authoring maintainable code that I think are said a lot, but not often said clearly enough.
Worry more about whether you code is readable and maintainable than whether it is fully optimized.
Code that is easy to read and maintain is fundamentally easier to optimize. Trying to start out by writing highly optimized code that is obscure leads to trouble.
Get code working with test coverage before refactoring.
I’m not a strict TDD practitioner, but its a practice that forces you into this mindset. Seriously, stop messing with it until the tests pass, and refactoring will be safer, faster, and even show you gaps in your test coverage.