Did I just resurrect the moment.cfc datetime library? Fork yeah I did!

Anyone besides me still using moment.cfc for datetime processing? :smile:

I see @bennadel mentioned in the file header comments as a “witting or otherwise” contributor!

While testing the Lucee 6.2 migration in my dev environment, there were a few breaking changes in moment.cfc. It’s been 8 years since the last commit to that repo and I see multiple pull requests unprocessed and questions never answered in Issues, so I guess it’s abandoned.

So I forked it and upgraded a bunch! I didn’t just fix the breaking changes, but even added new features.

Here’s my first commit message:

“Handle breaking changes from modern Java, commas, no-break spaces, and more datetime string formats: bash, Oracle, syslog, Apache logs”

Lucee’s native parseDateTime() is impressive and best when performance is top priority, but moment’s chaining is pretty cool and my fork handles more format types automatically.

At the very least this upgrade serves as a quick bridge to faster migration. Maybe I’ll refactor my entire codebase at some point in the future to use only parseDateTime() with fallback to my own small library of edge case handlers? Or who knows maybe not because moment.cfc is definitely more than performant enough for my current needs.

See my 5.4 vs 6.2RC datetime string format fail/pass comparison charts which also include columns for legacy Java, modern Java, and the original moment.cfc.

The charts reveal how Java can’t even parse the Narrow No-Break Space characters which are auto-inserted in the datetime-to-string methods of … Java! :rofl:

4 Likes