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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@janiscommerce/app-dates

v1.5.0

Published

Dates helper

Downloads

138

Readme

@janiscommerce app-dates

Build Status Coverage Status npm version

This package provides dates module for use in Janis apps.

📦 Installation

npm install @janiscommerce/apps-dates

The idea behind this package is to standardize the delivery date format for the different apps.

Examples

| Delivery date | Result | |---------------------------------------------------------|--------------------------------------------| | 2024-10-15T22:50:03.553Z | Until Oct 15, 19:50 hs | | 2024-10-18T22:50:03.553Z | Until today, 19:50 hs | | 2024-10-19T22:50:03.553Z | Until tomorrow, 19:50 hs | | 2024-10-18T20:50:03.553Z', '2024-10-18T22:50:03.553Z' | today, 17:50 - 19:50 hs | | 2024-10-19T20:50:03.553Z' , '2024-10-19T22:50:03.553Z' | Tomorrow, 17:50 - 19:50 hs | | 2024-10-20T22:50:03.553Z' , '2024-10-20T23:50:03.553Z | Oct 20, 19:50 - 20:50 hs | | 2024-10-20T22:50:03.553Z' , '2025-10-21T23:50:03.553Z | Oct 20 2024, 19:50 - Oct 21 2025, 20:50 hs | | 2024-10-20T22:50:03.553Z', '2024-10-21T22:50:03.553Z' | Oct 20, 19:50 - Oct 21, 19:50 hs |

Module

DateHandler

Kind: global class

new DateHandler(config)

| Param | Type | Default | Description | | --- | --- | --- | --- | | config | Object | | | | [config.locale] | "en" | "es" | "pt-BR" | "pt" | en | config.locale | | [config.debug] | boolean | false | config.debug |

Example

const Dates = new DateHandler({locale: 'es'})
const Dates = new DateHandler() // default locale 'en'

dateHandler.isValid(date) ⇒ boolean

Kind: instance method of DateHandler

| Param | Type | | --- | --- | | date | Date |

Example

const Dates = new DateHandler({locale: 'es'})
Dates.isValid('2024-10-04T21:26:33.801Z') // true
Dates.isValid('Janis commerce') // false

dateHandler.setLanguage(lang) ⇒ void

Kind: instance method of DateHandler

| Param | Type | | --- | --- | | lang | string |

Example

const Dates = new DateHandler({locale: 'es'})
Dates.setLanguage('en')

dateHandler.formatDelivery(date) ⇒ string | null

Kind: instance method of DateHandler

| Param | Type | Description | | --- | --- | --- | | date | Date | Array.<Date> | For more information, see formats |

Example

const Dates = new DateHandler({locale: 'es'})
Dates.formatDeliveryDate('2024-10-04T21:26:33.801Z') // 10/04/2024
Dates.formatDeliveryDate(['2024-10-20T22:50:03.553Z', '2024-10-21T22:50:03.553Z']), // 10/20 19:50 - 10/21 19:50

dateHandler.format(date, format, options) ⇒

Kind: instance method of DateHandler
Returns: The format function will return the result of the formatSingleDate function called with the provided date, format, and options. If the date argument is not a valid Date, an error message will be logged using logError and null will be returned.

| Param | Type | Description | | --- | --- | --- | | date | Date | The date parameter is the date that you want to format. It should be a valid Date object. | | format | string | The format parameter in the format function is used to specify the format in which the date should be displayed. It could be a string containing a combination of date and time format tokens, such as 'YYYY-MM-DD HH:mm:ss'. This format string defines how the date should be formatted For more information, see formats | | options | | Options is an object that can contain additional configuration settings for formatting the date. These settings can include things like specifying the time zone, customizing the output format, or providing any other specific requirements for formatting the date. locale inherits it from the instance of class For more information, see options |

Example

const Dates = new DateHandler({locale: 'es'})
Dates.format('2024-10-04T21:26:33.801Z', '') // 10/04/2024