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

moment-business

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moment-business

Methods to work with week days and weekends in moment.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

moment-business

Travis build status Code Climate Test Coverage Dependency Status devDependency Status

Utilities for working with week days and work days in Moment. It assumes a Western workweek, wherein weekends are Saturday and Sunday.

Motivation

Moment is an indispensable tool for working with dates in Javascript, but it doesn't supply methods for working with week days or weekend days (at least, not yet).

This library supplies you with those missing tools.

Why this library?

There are alternative libraries for these methods, but this one uses constant-time algorithms, and not loops. Loops are easier for a human to write, but they are slower for a computer to resolve.

API

workDays( otherMoment )

Calculate the number of work days between the moment and otherMoment. Work days are Monday through Friday.

weekendDays( otherMoment )

Calculate the number of weekend days between the moment and otherMoment. Weekend days are Saturday and Sunday.

addWorkDays( amount )

Add work days to a moment, modifying the original moment. Returns the moment.

subtractWorkDays( amount )

Subtract work days from the moment, modifying the original moment. Returns the moment.

isWorkDay()

Whether or not the Moment occurs between Monday and Friday.

isWekendDay()

Whether or not the Moment occurs on Saturday or Sunday.

Keywords

FAQs

Package last updated on 14 Feb 2015

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