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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@paul-fletes/acs-3310-js-date-library

v1.0.1

Published

![npm](https://img.shields.io/npm/v/%40paul-fletes%2Facs-3310-js-date-library) ![npm bundle size](https://img.shields.io/bundlephobia/min/%40paul-fletes%2Facs-3310-js-date-library) ![GitHub](https://img.shields.io/github/license/paul-fletes/ACS-3310-JS-Da

Downloads

1

Readme

ACS-3310-JS-DATE-LIBRARY

npm npm bundle size GitHub GitHub issues

This is a simple date manipulation and formatting library for JavaScript. It provides an easy way to work with Date objects and format them according to your needs. You can use this library to retrieve various properties of a date, format dates in different ways, and determine the relative time difference between two dates.

Installation

You can install the date library using npm or yarn:

npm install @paul-fletes/acs-3310-js-date-library

Usage

To use the date library in your JavaScript code, follow these steps:

  1. Import the library:
const DateLibrary = require('@paul-fletes/acs-3310-js-date-library');
  1. Create a DateLibrary object by passing a date or date-related arguments:
const myDate = new D(); // Current date and time
const customDate = new D(2023, 0, 15); // January 15, 2023
  1. Access date properties and methods:
// Getters
console.log(myDate.year);     // Full year (e.g., 2023)
console.log(myDate.yr);       // Last two digits of the year (e.g., 23)
console.log(myDate.month);    // Full name of the month (e.g., "September")
console.log(myDate.mon);      // Abbreviated name of the month (e.g., "Sep")
console.log(myDate.day);      // Full name of the day of the week (e.g., "Wednesday")
console.log(myDate.dy);       // Abbreviated name of the day of the week (e.g., "Wed")
console.log(myDate.date);     // Day of the month (e.g., 8)
console.log(myDate.hours);    // Hours (0-23)
console.log(myDate.mins);     // Minutes (0-59)
console.log(myDate.secs);     // Seconds (0-59)

// Format the date using a custom mask (default is 'Y M D')
console.log(myDate.format('Y-M-D H:I:S')); // Example output: "2023-September-08 14:30:45"

// Get the full name of the day of the week
console.log(myDate.dayOfWeekFull()); // Example output: "Wednesday"

// Get the abbreviated name of the day of the week
console.log(myDate.dayOfWeekShort()); // Example output: "Wed"

// Get the date with an ordinal suffix (e.g., 1st, 2nd, 3rd, 4th)
console.log(myDate.getDateWithOrdinal()); // Example output: "8th"

// Determine the relative time difference between the current date and this date
console.log(myDate.when()); // Example output: "just now"

Available Properties and Methods

Getters

  • year: Full year (e.g., 2023)
  • yr: Last two digits of the year (e.g., 23)
  • month: Full name of the month (e.g., "September")
  • mon: Abbreviated name of the month (e.g., "Sep")
  • day: Full name of the day of the week (e.g., "Wednesday")
  • dy: Abbreviated name of the day of the week (e.g., "Wed")
  • date: Day of the month (e.g., 8)
  • hours: Hours (0-23)
  • mins: Minutes (0-59)
  • secs: Seconds (0-59)

Methods

  • format(mask = 'Y M D'): Format the date using a specified mask. You can customize the format using placeholders like 'Y' (full year), 'y' (last two digits of the year), 'M' (full name of the month), and more.

  • dayOfWeekFull(): Get the full name of the day of the week.

  • dayOfWeekShort(): Get the abbreviated name of the day of the week.

  • getDateWithOrdinal(): Get the date with an ordinal suffix (e.g., 1st, 2nd, 3rd, 4th).

  • when(): Determine the relative time difference between the current date and this date, returning a string indicating the relative time difference (e.g., "just now", "5 minutes ago", "in 2 days").

Feel free to use this date library to simplify date manipulation and formatting in your JavaScript projects.