pg-interval
JSON →A lightweight JavaScript library for parsing, formatting, and performing arithmetic on PostgreSQL interval strings. Current version 1.0.8 provides tools to create interval objects from 'HH:MM:SS' strings, format them with custom templates, and perform add, subtract, multiply, and diff operations. Unlike heavier libraries like moment.js or Luxon, pg-interval focuses solely on the PostgreSQL interval format, making it ideal for simple interval manipulations without dependencies. The library mutates objects for add/subtract but offers a clone option for multiply. It is primarily CommonJS with no ESM exports.
Resources
packagepg-interval ↗