A JavaScript library that mimics PHP's date() function for formatting Date objects. Current stable version is 4.0.1. Ships TypeScript definitions, works in Node.js and all modern browsers including IE11. Key differentiators: small size (1.2KB gzipped), supports almost all PHP date format tokens except timezone identifiers (e, T), and provides a UTC variant date.UTC(). Active development with regular releases.
npm install php-dateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic formatting with PHP-style tokens, UTC variant, and defaulting to current time.
Use alternative methods like Intl.DateTimeFormat to get timezone identifiers, or avoid using those tokens.
Migrate to import date from 'php-date'
Use import date from 'php-date'
Use import date from 'php-date' or configure bundler to handle CommonJS.