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

is-x-time

v1.0.1

Published

Returns boolean for various time-of-day queries such as isNight and isBusinessHours

Downloads

14

Readme

is-x-time v1.0.0

CI

Evaluate common time-of-day periods.

Complete list of is-x-time functions

nowHour(): number

nowHourIn(tz: IANATimeZone): number

nowHourInAWS(awsrc: AWSRegionCode): number


isDayTime(): boolean

isDayTimeIn(tz: IANATimeZone): boolean

isDayTimeInAWS(awsrc: AWSRegionCode): boolean

isNightTime(): boolean

isNightTimeIn(tz: IANATimeZone): boolean

isNightTimeInAWS(awsrc: AWSRegionCode): boolean


isNight(): boolean

isNightIn(tz: IANATimeZone): boolean

isNightInAWS(awsrc: AWSRegionCode): boolean

isMorning(): boolean

isMorningIn(tz: IANATimeZone): boolean

isMorningInAWS(awsrc: AWSRegionCode): boolean

isAfternoon(): boolean

isAfternoonIn(tz: IANATimeZone): boolean

isAfternoonInAWS(awsrc: AWSRegionCode): boolean

isEvening(): boolean

isEveningIn(tz: IANATimeZone): boolean

isEveningInAWS(awsrc: AWSRegionCode): boolean


isBusinessHours(): boolean

isBusinessHoursIn(tz: IANATimeZone): boolean

isBusinessHoursInAWS(awsrc: AWSRegionCode): boolean


isDayShift(): boolean

isDayShiftIn(tz: IANATimeZone): boolean

isDayShiftInAWS(awsrc: AWSRegionCode): boolean

isEveningShift(): boolean

isEveningShiftIn(tz: IANATimeZone): boolean

isEveningShiftInAWS(awsrc: AWSRegionCode): boolean

isNightShift(): boolean

isNightShiftIn(tz: IANATimeZone): boolean

isNightShiftInAWS(awsrc: AWSRegionCode): boolean

Installation

Using npm:

npm i is-x-time

Size

Bundle Sizes

Usage

// CommonJS
const IsXTime = require('is-x-time');
// ES Modules
// Load full library
import * as IsXTime from "is-x-time";
// Load individual function(s)
import { isAfternoon, isBusinessHours, ... } from "is-x-time";
// Browser ES Modules
<script type="module" src="/path/to/is-x-time.es.js"></script>
<script type="module">
  import IsXTime from '/path/to/is-x-time.es.js';
  
  IsXTime.nowHour();
  // 0-23
</script>
// Browser UMD
<script type="module" src="/path/to/is-x-time.es.js"></script>
<script nomodule defer src="/path/to/web.is-x-time.js"></script>

Detailed list of is-x-time functions

Current Hour

nowHour()

24 Hour Clock

Returns the current hour number 0 - 23.

nowHourIn(tz: IANATimeZone)

Returns the current hour number 0 - 23 of the specified IANATimeZone.

nowHourInAWS(awsrc: AWSRegionCode)

Returns the current hour number 0 - 23 of the specified AWS Region Code.


NightTime, DayTime

NightTime, DayTime

A calendar day split into two 12 hour periods.


isNightTime()

NightTime

Time is between 6:00pm and 5:59am, inclusive.

Time is between 18:00 and 05:59, inclusive.

isNightTimeIn(tz: IANATimeZone)

Time is between 6:00pm and 5:59am, inclusive, in specified IANATimeZone.

Time is between 18:00 and 05:59, inclusive, in specified IANATimeZone.

isNightTimeInAWS(awsrc: AWSRegionCode)

Time is between 6:00pm and 5:59am, inclusive, in specified AWS Region Code.

Time is between 18:00 and 05:59, inclusive, in specified AWS Region Code.


isDayTime()

DayTime

Time is between 6:00am and 5:59pm, inclusive.

Time is between 06:00 and 17:59, inclusive.

isDayTimeIn(tz: IANATimeZone)

Time is between 6:00am and 5:59pm, inclusive, in specified IANATimeZone.

Time is between 06:00 and 17:59, inclusive, in specified IANATimeZone.

isDayTimeInAWS(awsrc: AWSRegionCode)

Time is between 6:00am and 5:59pm, inclusive, in specified AWS Region Code.

Time is between 06:00 and 17:59, inclusive, in specified AWS Region Code.


Night, Morning, Afternoon, Evening

Night, Morning, Afternoon, Evening

A calendar day split into four 6 hour periods.


isNight()

Night

Time is between 0:00am and 5:59am, inclusive.

Time is between 00:00 and 05:59, inclusive.

isNightIn(tz: IANATimeZone)

Time is between 0:00am and 5:59am, inclusive, in specified IANATimeZone.

Time is between 00:00 and 05:59, inclusive, in specified IANATimeZone.

isNightInAWS(awsrc: AWSRegionCode)

Time is between 0:00am and 5:59am, inclusive, in specified AWS Region Code.

Time is between 00:00 and 05:59, inclusive, in specified AWS Region Code.


isMorning()

Morning

Time is between 6:00am and 11:59am, inclusive.

Time is between 06:00 and 11:59, inclusive.

isMorningIn(tz: IANATimeZone)

Time is between 6:00am and 11:59am, inclusive, in specified IANATimeZone.

Time is between 06:00 and 11:59, inclusive, in specified IANATimeZone.

isMorningInAWS(awsrc: AWSRegionCode)

Time is between 6:00am and 11:59am, inclusive, in specified AWS Region Code.

Time is between 06:00 and 11:59, inclusive, in specified AWS Region Code.


isAfternoon()

Afternoon

Time is between 12:00pm and 5:59pm, inclusive.

Time is between 12:00 and 17:59, inclusive.

isAfternoonIn(tz: IANATimeZone)

Time is between 12:00pm and 5:59pm, inclusive, in specified IANATimeZone.

Time is between 12:00 and 17:59, inclusive, in specified IANATimeZone.

isAfternoonInAWS(awsrc: AWSRegionCode)

Time is between 12:00pm and 5:59pm, inclusive, in specified AWS Region Code.

Time is between 12:00 and 17:59, inclusive, in specified AWS Region Code.


isEvening()

Evening

Time is between 6:00pm and 11:59pm, inclusive.

Time is between 18:00 and 23:59, inclusive.

isEveningIn(tz: IANATimeZone)

Time is between 6:00pm and 11:59pm, inclusive, in specified IANATimeZone.

Time is between 18:00 and 23:59, inclusive, in specified IANATimeZone.

isEveningInAWS(awsrc: AWSRegionCode)

Time is between 6:00pm and 11:59pm, inclusive, in specified AWS Region Code.

Time is between 18:00 and 23:59, inclusive, in specified AWS Region Code.


Business Hours (9 2 5)

isBusinessHours()

Business Hours

Time is between 9:00am and 4:59pm, inclusive.

Time is between 09:00 and 16:59, inclusive.

isBusinessHoursIn(tz: IANATimeZone)

Time is between 9:00am and 4:59pm, inclusive, in specified IANATimeZone.

Time is between 09:00 and 16:59, inclusive, in specified IANATimeZone.

isBusinessHoursInAWS(awsrc: AWSRegionCode)

Time is between 9:00am and 4:59pm, inclusive, in specified AWS Region Code.

Time is between 09:00 and 16:59, inclusive, in specified AWS Region Code.


DayShift, EveningShift, NightShift

Night, Day, Evening Shifts

A calendar day split into three 8 hour periods.


isNightShift()

Night Shift

Time is between 0:00am and 7:59am, inclusive.

Time is between 00:00 and 07:59, inclusive.

isNightShiftIn(tz: IANATimeZone)

Time is between 0:00am and 7:59am, inclusive, in specified IANATimeZone.

Time is between 00:00 and 07:59, inclusive, in specified IANATimeZone.

isNightShiftInAWS(awsrc: AWSRegionCode)

Time is between 0:00am and 7:59am, inclusive, in specified AWS Region Code.

Time is between 00:00 and 07:59, inclusive, in specified AWS Region Code.


isDayShift()

Day Shift

Time is between 8:00am and 3:59pm, inclusive.

Time is between 08:00 and 15:59, inclusive.

isDayShiftIn(tz: IANATimeZone)

Time is between 8:00am and 3:59pm, inclusive, in specified IANATimeZone.

Time is between 08:00 and 15:59, inclusive, in specified IANATimeZone.

isDayShiftInAWS(awsrc: AWSRegionCode)

Time is between 8:00am and 3:59pm, inclusive, in specified AWS Region Code.

Time is between 08:00 and 15:59, inclusive, in specified AWS Region Code.


isEveningShift()

Evening Shift

Time is between 4:00pm and 11:59pm, inclusive.

Time is between 16:00 and 23:59, inclusive.

isEveningShiftIn(tz: IANATimeZone)

Time is between 4:00pm and 11:59pm, inclusive, in specified IANATimeZone.

Time is between 16:00 and 23:59, inclusive, in specified IANATimeZone.

isEveningShiftInAWS(awsrc: AWSRegionCode)

Time is between 4:00pm and 11:59pm, inclusive, in specified AWS Region Code.

Time is between 16:00 and 23:59, inclusive, in specified AWS Region Code.