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

tiny-period-checker

v1.0.2

Published

A lightweight component to check for dates in Annual, Quarterly, Monthly periods.

Downloads

6

Readme

Tiny Period Checker

Table of contents

Installation

Just go to your project folder and use the good old:

$ npm i tiny-period-checker

Then require it in your app:

const tpc = require('tiny-period-checker')

About the package

The purpose of the package itself if we use it as a whole tool is very specific but the problem it solves could be very usual in the relation of customer interactions or touchpoints. However, I found out during intensively checking StackOverflow for proper solutions that maybe some of its functions could be useful in more global use cases when someone has to check periods in time.

But first we need to clarify what is a touchpoint:

Touchpoint definition

What is a 'Touchpoint':

  • A touchpoint can be defined as any way a consumer can interact with a business,
  • Touchpoints in marketing communications are the varying ways that a brand interacts and displays information to prospective customers and current customers.
  • Touchpoints allow customers to have experiences every time they “touch’ any part of the product, service, brand or organization, across multiple channels and various points in time

What it does actually

With tiny-period-checker we can calculate if a client needs to be contacted soon since it has been contacted (in the code we use the 'clientTouchedAt' property) in the previous period but not in the current one ('Upcoming'), or already reached in the current period ('Done') or it is 'Missed' since it has not been touched in the previous period nor in the current one. The periods (in the code we call them 'frequency') could be 'Monthly', 'Quarterly', and 'Annual'.

What else it can be used for

While I wrote the package, I had to implement a few date related solutions which can be useful on their own. I will explain them in details later.I plan to include some more based on the top StackOverflow searches on this topic. Btw if you have any cool suggestion, do not hesitate to write me on [email protected]

How to use

Basic usage:

const tpc = require('tiny-period-checker')

const clientData = {
    clientTouchedAt: '2021-02-03T23:12:53.140Z',  // Could be any format that can be parsed to UTC. If it is null, the result will be automaticaly 'Upcoming'.
    frequency: 'Monthly'  // Could be Annual, Quarterly, Monthly.
    }

const type = tpc.calculateTouchPointType(clientData)

console.log(type)   // Possible types are: Missed, Done and Upcoming

Other functions:

This section is under construction....

Notes

  • This little package has no dependencies, no day.js, no moment.js, nothing at all
  • I have used UTC time to make (almost) sure that we won't misscalculate because of some server time conversion
  • You can check the basic tests in the github repo to understand more the behaviour
  • Again, feel free to contact me on [email protected]