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

natural-time-js

v1.0.4

Published

Natural time is a fresh, elegant, and coherent way of measuring the movements of time here on the Earth. This new time standard is based on common sense and the observation of natural cycles. Learn more: https://naturaltime.app. This JavaScript Class tran

Downloads

28

Readme

Natural time - JavaScript

Natural time is a fresh, elegant, and coherent way of measuring the movements of time here on the Earth.

This new time standard is based on common sense and the observation of natural cycles.

Natural time app

Play with natural time at https://naturaltime.app/

JavaScript library

This repository contains the JavaScript implementation of natural time.

index.js: This class translates artificial dates to natural dates.
context.js: Collection of utility functions for calculating sky context and events like moon phase, sunrise and sunset ...

Natural time specifications

How are natural years, moons, days, and time defined ?

Read the full specifications of natural time here: github.com/sylvain441/natural-time

Web application

You can play with natural time at https://naturaltime.app/. It both works online and offline thanks to this JavaScript library.

Natural time app

Javascript API

If you know how to deal with typescript/typings/documentation this repo may appreciate your help. Contribute here

Instalation

Install NPM package with your terminal:

npm install natural-time-js

NaturalDate Class

The NaturalDate class translates artificial dates into natural dates.

import { NaturalDate } from 'natural-time-js';

let artificialDate = new Date();
let longitude = 5.2;

let naturalDate = new NaturalDate(artificialDate, longitude);

Once instanciated, the naturalDate object holds many computed variables available for your usage:

unixTime; // Artificial gregorian date (UNIX timestamp)
longitude; // Longitude (between -180° to +180°)

year; // Current year (year 1: 2012/2013)
moon; // Current moon (between 1 and 14)

week; // Current week (between 1 and 53)
weekOfMoon; // Current week of the moon (between 1 and 4)

day; // Number of days passed since END_OF_ARTIFICIAL_TIME
dayOfYear; // Current day of the year (between 1 and 366)
dayOfMoon; // Current day of the moon (between 1 and 28)
dayOfWeek; // Current day of the week (between 1 and 7)

isRainbowDay; // True if current day is rainbow day

time; // Current time (between 0 and 359°999999...)

yearStart; // Beginning of the year at the current longitude (UNIX timestamp)
yearDuration; // Numbers of days in the current year (between 365 and 366)
nadir; // Beginning of the day at the current longitude (UNIX timestamp)

static END_OF_ARTIFICIAL_TIME = 1356091200000; // 2012-12-22 00:00:00 at +180° East;
static MILLISECONDS_PER_DAY = 86400000; // 24*60*60*1000

Utility functions

naturalDate.toString() // "004)04)01 113°00 NT+5.2"
naturalDate.toDateString(separator = ')') // "004)04)01"
naturalDate.toTimeString(decimals = 2, rounding = 1) // "113°00"
naturalDate.toLongitudeString(decimals = 1) // "NT+5.2"
naturalDate.toYearString() // "004"
naturalDate.toMoonString() // "04"
naturalDate.toDayOfMoonString() // "01"

More functions should be available later to make the NaturalDate class API mimic the native javascript Date class (ex: naturalDate.setYear(year)). Your help is welcome for this to happen ;-)

NaturalDateContext functions

The NaturalDateContext.js file contains utility functions to bring some astronomical context to the natural date (ex: altitude of the sun, phase of the moon).

import { NaturalSunAltitude, NaturalSunEvents, NaturalMoonPosition, NaturalMoonEvents } from 'natural-time-js/context';

// Gizeh pyramide
let latitude: 29.9791; 
let longitude: 31.1341;

let naturalDate = new NaturalDate(new Date(), longitude);

NaturalSunAltitude(naturalDate, latitude);
// altitude: 31.779736404754367, 
// highestAltitude: 62.32114911751647

NaturalSunEvents(naturalDate, latitude);
// sunrise: 70.56708493448893,
// sunset: 287.9105974344889,
// nightStart: 306.43507660115563,
// nightEnd: 52.13781826782227,
// morningGoldenHour: 80.8551891011556,
// eveningGoldenHour: 277.58920993448896

NaturalMoonPosition(naturalDate, latitude);
// phase: 74.86175469141531,
// altitude: 64.32391838504756,
// highestAltitude: 69.53997976716451

NaturalMoonEvents(naturalDate, latitude);
// moonrise: 139.14544743448894,
// moonset: 10.624722434488932

Important !
Utility functions return time-distance from 0° or false if the event does not occur during this day (ex: no sunrise at the north pole during winter).

Roadmap

  1. Test in real life
  2. Add typescript compatibility
  3. Make NaturalDate feel like the Javascript native Date Class by adding features like
    • getTime()
    • setMoon()
    • ...
  4. Make NaturalTime available for other programming languages

Contribute

Natural time is open to contributions from free-thinking minds. Find your way through Github or email at: [email protected] to get in touch.

License

Read full license (Creative Common Zero)

Natural time is completely free to use, play, transform, improve... It operates under the law of Love. Follow your heart, fork it, spoon it! There is no need to ask for permission to do anything with it.

Natural time is supposed to bring joy and ease to human life, not the opposite. What you make out of it is up to you and the assistance of life forces.

Acknowledgments

Natural time has been baking for a long time in a goat's mind while traveling around the world. Infinite gratitude to my beloved friends Uncle Skywalker and Ik: your precious insights into the Mayan universe were so inspiring.

Special thanks to Don Cross, author of the Astronomy Library for calculating celestial body events. https://github.com/cosinekitty/astronomy

It was a real pleasure to give birth of natural time during the spring/summer of 2022 in the peaceful French alps.

🌍 One love 🌎

🏔 🐐 🌞 🌈