A standalone JavaScript library for formatting and parsing dates using PHP-style date/time format strings. The latest stable version is 1.3.7 (released April 2016, last updated April 2018). It provides a DateFormatter class with methods like formatDate and guessDate, converting between Date objects and PHP format strings. Unlike moment.js or Luxon, it uses PHP date format specifiers, making it ideal for projects where PHP and JavaScript must share consistent date formats. It has no external dependencies and works in browsers and Node.js. Release cadence is low; the library is in maintenance mode.
npm install php-date-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates usage of DateFormatter to format a JavaScript Date object and parse a date string using PHP date formats.
Consider using a modern library like Luxon or date-fns if you need modules.
Always validate input string matches expected format before calling guessDate.
Be aware that output will be in local time zone. For UTC, wrap with Date's UTC methods.
Update any custom code that assumed jQuery is required; the library now works standalone.
Avoid using these format characters or test thoroughly.
Use const DateFormatter = require('php-date-formatter');Ensure php-date-formatter.min.js is loaded before your script.
Always convert input to Date object: new Date(dateStr) or new Date(timestamp).
No dependency data recorded yet.