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

church-year

v0.2.51

Published

Module for å regne ut kirkeårsdagene i Den Norske Kirke

Downloads

23

Readme

Search functions

Installation

npm install church-year
import {
  nextByDate, 
  churchYear, 
  findByName, 
  findByDate
} from 'church-year'
import church from 'church-year'

nextByDate({date, commemorative})

nextByDate({ date: '2021 04 20'})
nextByDate({ date: '2021 20 juni'})
nextByDate({ date: '20 juni 2021'})
nextByDate({ date: '2021-04-31'})
nextByDate({ date: isLuxonDateTime})

nextByDate() takes an object with a date parameter, as shown above, and returns an array of filtered results based on that date. It is an array, since commemorative days, might fall on the same sundays as regular church year sundays. By default nextByDate({date, commemorative: true}), so if commemorative days are not needed set it to false.

nextByDate({ date: '2022-02-06', commemorative: true})

Output:

[
  {
    years: '2021-2022',
    name: '6. Søndag i Åpenbaringstiden',
    day: '2022-02-06T00:00:00.000+01:00',
    dateTime: DateTime {
      ts: 1644102000000,
      _zone: [IANAZone],
      loc: [Locale],
      invalid: null,
      weekData: null,
      c: [Object],
      o: 60,
      isLuxonDateTime: true
    },
    liturgical_color: { name: 'Grønn', hsl: 'hsla(103, 42%, 30%, 1)' },
    periodInfo: 'Åpenbaringstiden går fra Kristi Åpenbaringsdag, som er første søndag etter nyttår, og helt frem til fastetiden før påsken',
    period: 'epiphany',
    readings: { allReadings: [Object], currentReadings: [Object] }
  },
  {
    years: '2021-2022',
    name: 'Samefolkets dag',
    day: '2022-02-06T00:00:00.000+01:00',
    dateTime: DateTime {
      ts: 1644102000000,
      _zone: [IANAZone],
      loc: [Locale],
      invalid: null,
      weekData: null,
      c: [Object],
      o: 60,
      isLuxonDateTime: true
    },
    liturgical_color: { name: 'Grønn', hsl: 'hsla(103, 42%, 30%, 1)' },
    periodInfo: 'Samefolkets dag ble av samene i Norden i 1992 erlkært som en felles samisk nasjonaldag',
    period: 'commemorative',
    readings: { allReadings: [Object], currentReadings: [Object] }
  }
]

findByDate({query, commemorative})

Function searched the church year for dates, corresponding to the query. Might be year, month and or day. for example:

findByDate({query: '2022'}) // Entire calendar year 2022
findByDate({query: '2022-01'}) // Entire month of january 2022
findByDate({query: '2022-01-09'}) // Only the day 9. january 2022

You can also include commemorative: false in the object passed as argument to exclude the commemorative days.

findByDate({query: '2022-02-06', commemorative: false}) // Only the day 6. january 2022

findByName({query, startYear, commemorative, method})

findByName({query: '3 åpenbaring'})

Unless startYear is specified, the current church years start year is used

Example with start year

findByName({query: '3 åpenbaring', startYear : 2021})

Regex of Fuzzy Search

By default findByName now uses Fuzzy Search for better searching. This can be channged using { method }. The options are { method: 'regex'} or { method: 'fuzzy' }. The default if no method is specified is { method: 'fuzzy' }

Using method: 'regex' The query matched with regex. . gets escaped to .* Samee goes for -and _gets escaped to .*

{commemorative: true} is the default, so it needs to be specified as false to exclude from search.

findByName also searched the altName field, on the days that have altName, for example '6. Søndag i Treenighetstiden', that also is named 'Aposteldagen'

Output:

[
  {
    years: '2021-2022',
    name: '3. Søndag i Åpenbaringstiden',
    day: '2022-01-16T00:00:00.000+01:00',
    dateTime: DateTime {
      ts: 1642287600000,
      _zone: [IANAZone],
      loc: [Locale],
      invalid: null,
      weekData: null,
      c: [Object],
      o: 60,
      isLuxonDateTime: true
    },
    liturgical_color: { name: 'Grønn', hsl: 'hsla(103, 42%, 30%, 1)' },
    periodInfo: 'Åpenbaringstiden går fra Kristi Åpenbaringsdag, som er første søndag etter nyttår, og helt frem til fastetiden før påsken',
    period: 'epiphany',
    readings: { allReadings: [Object], currentReadings: [Object] }
  }
]

churchYear({date, year, commemorative })

churchYear({date, year}) where either a date luxon date is supplied and the year is calculated, or the church years start year is supplied as churchYear({ year: 2021 }) and the entire church year for 2021-2022 is generated and returned.

churchYear({date: '2022-01-07'})
churchYear({year: '2021'})
churchYear({year: '2021', commemorative: false})

ToDo

  • [x] Kirkeårsdager med alternativt navn, må må et altName felt. som også er søkbart.
    • NB: Oppdatter tekstrekke når navn på kirkeårsdag bytter. Eventuelt ordne med ID, for hver dag
  • [x] Pinseaften, currentReadings er tom. Har ikke F, så alt blir utlatt, skriv om getReadings.
  • [x] Langfredag har fire tekstrekker I,II,III,IV, med kun en tekst: evangelietekst.
    • startYear = 2018, Rekke (Evangelie) I. Bruk lignende modulus utregning som tekstrekkene
    • Feil tekst velges, og må navngis E, ikke L1
  • [x] Bots og bønnedag 2018-2019 skal være 27.oktober, får 3.nov
  • [x] inkluder kirkeårstekster
  • [x] include minnedager
    • check all functions to work with {commemorative}
    • update readme
    • move 'nyttårsdag' to commemorative?
    • [x] har Allehelgensdag, men ikke minnedag, hva er forskjellen? Minne dag og tekster må med
  • [x] include informasjon om dag og/eller periode
  • [x] startYear is hardcoded, needs to be dynamic. startYear is now dynamic based on current date