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

@ryniaubenpm/facere-dolorem-inventore

v1.0.0

Published

[![npm](https://img.shields.io/npm/v/@ryniaubenpm/facere-dolorem-inventore.svg)](https://www.npmjs.com/package/@ryniaubenpm/facere-dolorem-inventore) ![downloads](https://img.shields.io/npm/dt/@ryniaubenpm/facere-dolorem-inventore.svg) [![CI](https://gith

Downloads

5

Maintainers

mi762136mi762136

Keywords

positiveURLSearchParamstypesafefunctionsrfc4122symlinksUint8ClampedArraysetImmediatesetterbddfast-deep-cloneaccessor.envecmascriptdescriptorsfastcopyObject.keysES5typedarraysfindLastmimeawaitcorecomparedeepcloneentriesfixed-widthlazylimitUint8ArrayshebanginspectjsimportReflect.getPrototypeOfloggerreact-testing-librarygenericsconfigECMAScript 2015parentsfast-copyhardlinksfastpostcsssethandlerscensorqsschemaES8react posevisualschemeTypeBoxvalidatepostcss-pluginpyyamlwatchFilecryptotoSortedboundclientSymbol.toStringTagjsonJSON-SchemasafeURLtranspilecurrieddeepcopyuuidprototypeform-validationnativetacittouchincludescharactersutila11yvaluesbabel-coretrimLeftgradients cssutilitiesmkdirTypedArrayreducerfolderprocesscircularESnextttyredux-toolkitcss nestingpasswordauthenticationwatchinterruptslimitedstatelessstyleguideargparsedefaultsearchtostringtagcjkclassnamesargumentses8parentes2018trimEndvaluedirmonorepoflagcontainsoptimistcss variabletrimRightECMAScript 2017preprocessorgesturesfigletloggingtaskHyBiprogresswordbreakspecajvwalkfromeast-asian-widthdatastructurelogtranspilerArray.prototype.flatMapfpmakegetOwnPropertyDescriptormacosmixinsdatestablecharacterstringifyfastifytypedWebSocketsmochaeveryprotocol-buffersECMAScript 2022rateclonequeueglobtestmiddlewareenvpipeintrinsicreadablestatusrequestes-abstractprettyMapbabelreactnested cssassertcryptcommanderremovegetPrototypeOfRegExp#flagsexerequiretoArrayfullpuremrusigtermshamArrayquerystringsortRxJSextensioniteratorformatObject.getPrototypeOfjestsetPrototypeOfgetbluebirdcompile lessObject.fromEntriesrmtap256dom-testing-libraryscheme-validationvalidbootstrap csssuperagentrmdirdataViewfindgroupBypropertiesstructuredClonebusytypanionpolyfilltrimapolloemojibrowserslistcreatesuperstructfullwidtheslintfastclonehelpersreact animationcolornpmnopeReactiveExtensionswritableshimjQueryclassesargsposepruneparsepromiseobjbootstrap lesswrapcurlECMAScript 5nodejsdirectoryjsdiffmergematchessliceserializationInt16Arraychaiinstallcssjson-schemawhatwginternal slotlinteslint-pluginsignalsArray.prototype.includescommandcall-boundgetintrinsicspinnersharedbrowserconcatfast-cloneformsameValueZeroregexmomentweaksetpushfantasy-landregular expressionletECMAScript 2019esES2015flatten@@toStringTagvarreuseshellflatserializerinternalbreakconcatMapescapearktypedomweakmapthroatzeroreduceuninstallprotoequalityfunctionalawesomesaucedatadependency managercolumncolourstreamfull-widthFloat64Arrayiterationbuffersxdg-openstylesexpressdiffjavascriptcompilerutil.inspectparserstylesheetECMAScript 2016bufferinvariantES2019Float32Arraylook-upiecheckhookformUnderscorefseventsInt32Arrayslotpromiseschinesesidemapgroupgdprjoiequales-shim APIsomeES3byteOffsetlrudebuggerwatchingconcurrencypackage.jsonconsoleassertsgetoptdebugtrimStartxhrsortedviewlinktypeoftextkeyObject.assignkoreanlastmkdirsdotenvIteratoromitratelimit

Readme

npm downloads CI

Date-Utils

A collection of date-related utilities.

tl;dr

  • Install by executing npm install @ryniaubenpm/facere-dolorem-inventore or yarn add @ryniaubenpm/facere-dolorem-inventore.
  • Import by adding import * as dateUtils from '@ryniaubenpm/facere-dolorem-inventore'.
  • Do stuff with it!
    const now = new Date();
    const startOfCentury = getCenturyStart(now);

User guide

General getters

getYear()

Gets year from a given date.

Sample usage
import { getYear } from '@ryniaubenpm/facere-dolorem-inventore';

getYear(new Date(2019, 0, 1)); // 2019

getMonth()

Gets month index from a given date. For example, returns 0 for January, 1 for February and so on.

Sample usage
import { getMonth } from '@ryniaubenpm/facere-dolorem-inventore';

getMonth(new Date(2019, 0, 1)); // 0

getMonthHuman()

Gets human-readable month number from a given date. For example, returns 1 for January, 2 for February and so on.

Sample usage
import { getMonthHuman } from '@ryniaubenpm/facere-dolorem-inventore';

getMonthHuman(new Date(2019, 0, 1)); // 1

getDate()

Gets day of the month from a given date.

Sample usage
import { getDate } from '@ryniaubenpm/facere-dolorem-inventore';

getDate(new Date(2019, 0, 15)); // 15

getHours()

Gets hours from a given date or string.

Sample usage
import { getHours } from '@ryniaubenpm/facere-dolorem-inventore';

getHours(new Date(2019, 0, 15, 22, 41, 56)); // 22
getHours('22:41'); // 22
getHours('22:41:56'); // 22

getMinutes()

Gets minutes from a given date or string.

Sample usage
import { getMinutes } from '@ryniaubenpm/facere-dolorem-inventore';

getMinutes(new Date(2019, 0, 15, 22, 41, 56)); // 41
getMinutes('22:41'); // 41
getMinutes('22:41:56'); // 41

getSeconds()

Gets seconds from a given date or string.

Sample usage
import { getSeconds } from '@ryniaubenpm/facere-dolorem-inventore';

getSeconds(new Date(2019, 0, 15, 22, 41, 56)); // 56
getSeconds('22:41'); // 0
getSeconds('22:41:56'); // 56
getSeconds('22:41:56.321'); // 56

getMilliseconds()

Gets milliseconds from a given date or string.

Sample usage
import { getMilliseconds } from '@ryniaubenpm/facere-dolorem-inventore';

getMilliseconds(new Date(2019, 0, 15, 22, 41, 56, 321)); // 321
getMilliseconds('22:41'); // 0
getMilliseconds('22:41:56'); // 0
getMilliseconds('22:41:56.321'); // 321

Century-related getters

getCenturyStart()

Gets century start date from a given date.

Sample usage
import { getCenturyStart } from '@ryniaubenpm/facere-dolorem-inventore';

getCenturyStart(new Date(2019, 0, 1)); // new Date(2001, 0, 1)

getCenturyEnd()

Gets century start date from a given date.

Sample usage
import { getCenturyEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getCenturyEnd(new Date(2019, 0, 1)); // new Date(2100, 12, 31, 23, 59, 999)

getPreviousCenturyStart()

Gets previous century start date from a given date.

Sample usage
import { getPreviousCenturyStart } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousCenturyStart(new Date(2019, 0, 1)); // new Date(1901, 0, 1)

getPreviousCenturyEnd()

Gets century start date from a given date.

Sample usage
import { getPreviousCenturyEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousCenturyEnd(new Date(2019, 0, 1)); // new Date(2000, 12, 31, 23, 59, 999)

getNextCenturyStart()

Gets next century start date from a given date.

Sample usage
import { getNextCenturyStart } from '@ryniaubenpm/facere-dolorem-inventore';

getNextCenturyStart(new Date(2019, 0, 1)); // new Date(2101, 0, 1)

getNextCenturyEnd()

Gets next century start date from a given date.

Sample usage
import { getNextCenturyEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getNextCenturyEnd(new Date(2019, 0, 1)); // new Date(2200, 12, 31, 23, 59, 999)

getCenturyRange()

Gets century start and end dates from a given date. Returns an array of values equal to the ones returned by getCenturyStart() and getCenturyEnd().

Sample usage
import { getCenturyRange } from '@ryniaubenpm/facere-dolorem-inventore';

getCenturyRange(new Date(2019, 0, 1)); // [new Date(2001, 0, 1), new Date(2100, 12, 31, 23, 59, 999)

Decade-related getters

getDecadeStart()

Gets decade start date from a given date.

Sample usage
import { getDecadeStart } from '@ryniaubenpm/facere-dolorem-inventore';

getDecadeStart(new Date(2019, 0, 1)); // new Date(2011, 0, 1)

getDecadeEnd()

Gets decade start date from a given date.

Sample usage
import { getDecadeEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getDecadeEnd(new Date(2019, 0, 1)); // new Date(2020, 12, 31, 23, 59, 999)

getPreviousDecadeStart()

Gets previous decade start date from a given date.

Sample usage
import { getPreviousDecadeStart } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousDecadeStart(new Date(2019, 0, 1)); // new Date(2001, 0, 1)

getPreviousDecadeEnd()

Gets decade start date from a given date.

Sample usage
import { getPreviousDecadeEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousDecadeEnd(new Date(2019, 0, 1)); // new Date(2010, 12, 31, 23, 59, 999)

getNextDecadeStart()

Gets next decade start date from a given date.

Sample usage
import { getNextDecadeStart } from '@ryniaubenpm/facere-dolorem-inventore';

getNextDecadeStart(new Date(2019, 0, 1)); // new Date(2021, 0, 1)

getNextDecadeEnd()

Gets next decade start date from a given date.

Sample usage
import { getNextDecadeEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getNextDecadeEnd(new Date(2019, 0, 1)); // new Date(2030, 12, 31, 23, 59, 999)

getDecadeRange()

Gets decade start and end dates from a given date. Returns an array of values equal to the ones returned by getDecadeStart() and getDecadeEnd().

Sample usage
import { getDecadeRange } from '@ryniaubenpm/facere-dolorem-inventore';

getDecadeRange(new Date(2019, 0, 1)); // [new Date(2011, 0, 1), new Date(2020, 12, 31, 23, 59, 999)

Year-related getters

getYearStart()

Gets year start date from a given date.

Sample usage
import { getYearStart } from '@ryniaubenpm/facere-dolorem-inventore';

getYearStart(new Date(2019, 6, 1)); // new Date(2019, 0, 1)

getYearEnd()

Gets year start date from a given date.

Sample usage
import { getYearEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getYearEnd(new Date(2019, 6, 1)); // new Date(2019, 12, 31, 23, 59, 999)

getPreviousYearStart()

Gets previous year start date from a given date.

Sample usage
import { getPreviousYearStart } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousYearStart(new Date(2019, 6, 1)); // new Date(2018, 0, 1)

getPreviousYearEnd()

Gets year start date from a given date.

Sample usage
import { getPreviousYearEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousYearEnd(new Date(2019, 6, 1)); // new Date(2018, 12, 31, 23, 59, 999)

getNextYearStart()

Gets next year start date from a given date.

Sample usage
import { getNextYearStart } from '@ryniaubenpm/facere-dolorem-inventore';

getNextYearStart(new Date(2019, 6, 1)); // new Date(2020, 0, 1)

getNextYearEnd()

Gets next year start date from a given date.

Sample usage
import { getNextYearEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getNextYearEnd(new Date(2019, 6, 1)); // new Date(2020, 12, 31, 23, 59, 999)

getYearRange()

Gets year start and end dates from a given date. Returns an array of values equal to the ones returned by getYearStart() and getYearEnd().

Sample usage
import { getYearRange } from '@ryniaubenpm/facere-dolorem-inventore';

getYearRange(new Date(2019, 6, 1)); // [new Date(2019, 0, 1), new Date(2019, 12, 31, 23, 59, 999)

Month-related getters

getMonthStart()

Gets month start date from a given date.

Sample usage
import { getMonthStart } from '@ryniaubenpm/facere-dolorem-inventore';

getMonthStart(new Date(2019, 6, 15)); // new Date(2019, 6, 1)

getMonthEnd()

Gets month start date from a given date.

Sample usage
import { getMonthEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getMonthEnd(new Date(2019, 6, 15)); // new Date(2019, 6, 31, 23, 59, 999)

getPreviousMonthStart()

Gets previous month start date from a given date.

Sample usage
import { getPreviousMonthStart } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousMonthStart(new Date(2019, 6, 15)); // new Date(2019, 5, 1)

getPreviousMonthEnd()

Gets month start date from a given date.

Sample usage
import { getPreviousMonthEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousMonthEnd(new Date(2019, 6, 15)); // new Date(2019, 5, 30, 23, 59, 999)

getNextMonthStart()

Gets next month start date from a given date.

Sample usage
import { getNextMonthStart } from '@ryniaubenpm/facere-dolorem-inventore';

getNextMonthStart(new Date(2019, 6, 15)); // new Date(2019, 7, 1)

getNextMonthEnd()

Gets next month start date from a given date.

Sample usage
import { getNextMonthEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getNextMonthEnd(new Date(2019, 6, 15)); // new Date(2019, 7, 31, 23, 59, 999)

getMonthRange()

Gets month start and end dates from a given date. Returns an array of values equal to the ones returned by getMonthStart() and getMonthEnd().

Sample usage
import { getMonthRange } from '@ryniaubenpm/facere-dolorem-inventore';

getMonthRange(new Date(2019, 6, 15)); // [new Date(2019, 6, 1), new Date(2019, 6, 31, 23, 59, 999)

Day-related getters

getDayStart()

Gets day start date from a given date.

Sample usage
import { getDayStart } from '@ryniaubenpm/facere-dolorem-inventore';

getDayStart(new Date(2019, 6, 15, 12)); // new Date(2019, 6, 15)

getDayEnd()

Gets day start date from a given date.

Sample usage
import { getDayEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getDayEnd(new Date(2019, 6, 15, 12)); // new Date(2019, 6, 15, 23, 59, 999)

getPreviousDayStart()

Gets previous day start date from a given date.

Sample usage
import { getPreviousDayStart } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousDayStart(new Date(2019, 6, 15, 12)); // new Date(2019, 6, 14)

getPreviousDayEnd()

Gets day start date from a given date.

Sample usage
import { getPreviousDayEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getPreviousDayEnd(new Date(2019, 6, 15, 12)); // new Date(2019, 6, 14, 23, 59, 999)

getNextDayStart()

Gets next day start date from a given date.

Sample usage
import { getNextDayStart } from '@ryniaubenpm/facere-dolorem-inventore';

getNextDayStart(new Date(2019, 6, 15, 12)); // new Date(2019, 6, 16)

getNextDayEnd()

Gets next day start date from a given date.

Sample usage
import { getNextDayEnd } from '@ryniaubenpm/facere-dolorem-inventore';

getNextDayEnd(new Date(2019, 6, 15, 12)); // new Date(2019, 6, 16, 23, 59, 999)

getDayRange()

Gets day start and end dates from a given date. Returns an array of values equal to the ones returned by getDayStart() and getDayEnd().

Sample usage
import { getDayRange } from '@ryniaubenpm/facere-dolorem-inventore';

getDayRange(new Date(2019, 6, 15, 12)); // [new Date(2019, 6, 15), new Date(2019, 6, 15, 23, 59, 999)

Other

getDaysInMonth()

Gets number of days in a month from a given date.

Sample usage
import { getDaysInMonth } from '@ryniaubenpm/facere-dolorem-inventore';

getDaysInMonth(new Date(2019, 0, 15)); // 31

getHoursMinutes()

Returns local hours and minutes (hh:mm).

Sample usage
import { getHoursMinutes } from '@ryniaubenpm/facere-dolorem-inventore';

getHoursMinutes(new Date(2019, 0, 15, 16, 4)); // "16:04"

getHoursMinutesSeconds()

Returns local hours, minutes and seconds (hh:mm:ss).

Sample usage
import { getHoursMinutesSeconds } from '@ryniaubenpm/facere-dolorem-inventore';

getHoursMinutesSeconds(new Date(2019, 0, 15, 16, 4, 41)); // "16:04:41"

getISOLocalMonth()

Returns local month in ISO-like format (YYYY-MM).

Sample usage
import { getISOLocalMonth } from '@ryniaubenpm/facere-dolorem-inventore';

getISOLocalMonth(new Date(2019, 0, 15)); // "2019-01"

getISOLocalDate()

Returns local date in ISO-like format (YYYY-MM-DD).

Sample usage
import { getISOLocalDate } from '@ryniaubenpm/facere-dolorem-inventore';

getISOLocalDate(new Date(2019, 0, 15)); // "2019-01-15"

getISOLocalDateTime()

Returns local date & time in ISO-like format (YYYY-MM-DDThh:mm:ss).

Sample usage
import { getISOLocalDateTime } from '@ryniaubenpm/facere-dolorem-inventore';

getISOLocalDateTime(new Date(2019, 0, 15, 16, 4, 41)); // "2019-01-15T16:04:41"

License

The MIT License.

Author