JSPM

@mlnop/seasonscalc

3.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q59239F
  • License ISC

Return seasons based on equinoxes and current date

Package Exports

  • @mlnop/seasonscalc

Readme

seasonsCalc

seasonsCalc is a tiny Javascirpt library for calculating the season based on the current time. Dev insipired by the php version with the help of this documentation

Usage example

seasonsCalc is available as an NPM package:

npm i @mlnop/seasonscalc --save-dev
const seasonsCalc = require('@mlnop/seasonscalc')
// OR
import seasonsCalc from '@mlnop/seasonsCalc'

const actualSeason = seasonsCalc()
const datedSeason = seasonsCalc(new Date('2023-12-22 12:21:00'))

Reference

Returns a string with the season like "winter", "spring", "summer" or "autumn"

Changelog

3.0.1 — 02/01/2025

  • Add TypeScript support and unit tests

2.0.0 — 27/12/2023

  • You can now add parameter when calling the function
  • Fix "Returns undefined in winter" error (issue)
  • Fix equinox datas (issue)

1.0.0 — 07/11/2022

  • First commit.
  • Published to NPM.