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

node-red-contrib-simpletime

v3.0.2

Published

A lightweight node-red node to provide and format date and time.

Downloads

1,770

Readme

node-red-contrib-simpletime

NPM version NPM downloads per month NPM downloads total MIT License JavaScript Style Guide

A Node-RED node that is extremely lightweight and which can be inserted in any running flow, and adds time and date payloads with various formatting options, which can be retreived and used later in the flow.
It can also accept an input of a date (see inputs below), and use that date to calculate simpletime's outputs.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-contrib-simpletime

Usage

Inputs

Any existing payloads or topics being injected into simpletime will pass unaltered through the node except msg.date
If msg.date is present, it MUST contain a valid date that could be processed by the new Date() constructor such as;
2024-04-16T12:02:05Z
Mon, 22 Apr 2024 19:55:05 GMT
2024-05-11
1715538484102 (as a number)

If msg.date is not present, simpletime will calculate it's outputs based on the current date & time.

Outputs

In addition to any existing payloads, a number of additional payloads will be added, which can be utilised later in the flow.
By default, all the additional properties will be added to the message but this can be altered in the node configuration, using checkboxes

Details

The additional payloads added to the flow, and their typical content format are;

  • msg.mydate: "Tue Sep 11 2018"
  • msg.myymd: "2018-09-11"
  • msg.myyear: "2018"
  • msg.mymonth: "Sep"
  • msg.mymonthf: "September"
  • msg.mymonthn: "09"
  • msg.mydom: "11"
  • msg.mydoy: "86"
  • msg.myday: "Tue"
  • msg.mydayf: "Tuesday"
  • msg.myhourpm: "7"
  • msg.myhour: "19"
  • msg.mytime: "19:51"
  • msg.mytimes: "19:51:17"
  • msg.myminute: "51"
  • msg.myminutes: "51:17"
  • msg.mysecond: "17"
  • msg.mymillis: "985"
  • msg.myepoch: "1536691877064"
  • msg.myrawdate: "2018-09-11T18:51:17.064Z"
  • msg.mypm: "PM"

To introduce any of the messages into a flow, simply assign any, or any combination of the messages into a variable, such as; var seconds = msg.myseconds; or to use in a ui_text node add via mustache {{mytimes}}
More advanced date formats can also be constructed, such as {{mytime}}hrs - {{mydom}}/{{mymonth}} to get "20:10hrs - 11/Sep", or {{myhourpm}}:{{myminute}}{{mypm}} to get "8.10PM"

For more advanced timezone handling, node-red-contrib-moment is recommended.