npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

phane-tech-date-time-utils

v1.0.2

Published

Pure JavaScript array utility functions

Readme

📦 Kotipalli Phaneendra Kumar – Date & Time Utilities

A lightweight, dependency-minimal JavaScript module that provides safe, consistent, and reusable Date & Time helper functions.

These utilities simplify working with dates, times, months, weekdays, and financial years, handling edge cases cleanly and predictably.

Designed for frontend (Vue/React) and Node.js applications.


✨ Highlights

  • ⏰ Time formatting (12h / 24h)
  • 🕒 Human‑readable relative time ("few moments ago")
  • 📅 Month & weekday helpers (names & numbers)
  • 💼 Financial year utilities (current, offset, range)
  • 🌍 Locale‑aware formatting
  • 🧪 Jest‑friendly & predictable outputs
  • ⚡ Zero heavy dependencies

📦 Installation

npm install phane-tech-date-time-utils

🚀 Import

import {
  getTime,
  getTimeAgo,
  getMonth,
  getYear,
  getMonthName,
  getDayName,
  getAllMonths,
  getAllDayNames,
  getFinancialYear,
  getFinancialYearByOffset,
  getFinancialYearsBetween,
  getMonthsBetween,
  getDateTime,
  isWeekend
} from "phane-js-datetime-utils";

📚 API Reference & Examples

⏰ getTime(isRailway, date)

getTime();                     // "03:45:10 PM"
getTime(true);                 // "15:45:10"
getTime(false, "2026-01-10");  // Time for given date

🕒 getTimeAgo(date)

getTimeAgo(new Date());               // "few moments ago"
getTimeAgo(Date.now() - 60000);       // "1 min ago"
getTimeAgo(Date.now() - 7200000);     // "2 hours ago"
getTimeAgo("2025-04-12");             // "x months ago"

📅 getMonth / getYear

getMonth();            // 1–12
getMonth("2026-05");   // 5

getYear();             // 2026
getYear("2020-01");    // 2020

🗓 getMonthName / getDayName

getMonthName(true);        // "January"
getMonthName(false);       // "Jan"

getDayName();              // "Monday"
getDayName(false);         // "Mon"

📆 getAllMonths / getAllDayNames

getAllMonths();        // ["January", ...]
getAllMonths(false);   // ["Jan", ...]

getAllDayNames();      // ["Sunday", ...]
getAllDayNames(false); // ["Sun", ...]

💼 Financial Year Helpers

getFinancialYear("2026-01-10");      // "2025-2026"
getFinancialYearByOffset(-1);        // Previous FY
getFinancialYearByOffset(1);         // Next FY

getFinancialYearsBetween(
  "2021-01-01",
  "2024-12-31"
);
// ["2020-2021","2021-2022","2022-2023","2023-2024"]

🗓 Months Between Dates

getMonthsBetween("2026-01-01", "2026-04-01");
// ["January","February","March","April"]

getMonthsBetween("2026-01-01", "2026-04-01", { asNumber: true });
// [1,2,3,4]

getMonthsBetween("2026-01-01", "2026-04-01", { fullName: false });
// ["Jan","Feb","Mar","Apr"]

🕰 getDateTime

getDateTime();
// "10/01/2026, 03:45 PM"

getDateTime("2026-01-10", false);
// "10/01/2026"

getDateTime("2026-01-10", true, true);
// "10/01/2026, 15:45"

📌 isWeekend

isWeekend("2026-01-11"); // true

🧪 Testing

  • Fully compatible with Jest
  • Deterministic outputs
  • Ideal for unit & snapshot testing

📄 License

MIT


🔗 Links

  • Author: Kotipalli Phaneendra Kumar
  • GitHub Repository: https://phane-tech.github.io/phane-tech-date-time-utils
  • Demo / Documentation: https://phane-tech.github.io/phane-tech-date-time-utils/module-DateTimeHelpers.html
  • Unit Test Cases Reports: https://phane-tech.github.io/phane-tech-date-time-utils/unit-test-report.html