Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@slay-pics/date-utils

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slay-pics/date-utils

Variety of date utilities

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by600%
Maintainers
1
Weekly downloads
 
Created
Source

@slay-pics/date-utils

npm version npm downloads bundle Codecov

A handful of date utilities used on Slay.

Usage

Install package:

# npm
npm install @slay-pics/date-utils

# yarn
yarn add @slay-pics/date-utils

# pnpm
pnpm install @slay-pics/date-utils

# bun
bun install @slay-pics/date-utils

Usage

  • addYears(date, amount)
  • addMonths(date, amount)
  • addDays(date, amount)
  • addHours(date, amount)
  • addMinutes(date, amount)
  • addSeconds(date, amount)

Adds the specified amount of units to a date. Date can be a string, a JS date or null. If null is passed, then the current date is used.

  • isPast(date)
  • isFuture(date)

Determines if the given date occurs in the past or future.

  • isWithinYears(date, amount)
  • isWithinMonths(date, amount)
  • isWithinDays(date, amount)
  • isWithinHours(date, amount)
  • isWithinMinutes(date, amount)
  • isWithinSeconds(date, amount)

Determines if the specified date is within the given range of the current date.

  • dayDiff(date1, date2)

Returns the difference between two dates in days

  • thisMonth(date)

Returns a date that is the 1st day of the month of the specified date.

  • previousMonth(date)

Returns a date that is the 1st day of the prior month of the specified date.

  • nextMonth(date)

Returns a date that is the 1st day of the next month of the specified date.

License

Published under MIT License.

FAQs

Package last updated on 30 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc