getsurei

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2025 License: BSD-2-Clause Imports: 2 Imported by: 0

README

getsurei (月齢)

I'm pretty sure I'm connected to the moon.

ー David Lynch

lunar whimsy. getsurei estimates primary moon phases and the age of the moon.

intentionally imprecise.

getsurei in action

usage

now := time.Now()
switch getsurei.Gessou(now) {
case NewMoon:
  fmt.Println("hiding out all night")
case FirstQuarter:
  fmt.Println("still not full")
case FullMoon:
  fmt.Println("bold and bright")
case LastQuarter:
  fmt.Println("whisper goodbye with a quiet thrill")
}

age := getsurei.Getsurei(now)
fmt.Printf("%f days since the new moon\n", age)

fullmoon := getsurei.Next(getsurei.FullMoon, now)
fmt.Printf("net full moon: %s\n", fullmoon.Format("2006.01.02)")

command line

$ date
Mon Jan 27 17:27:07 JST 2025
$ getsurei
下弦の月
$ getsurei 2025.01.01
新月

Documentation

Overview

Package getsurei estimates primary moon phases and the age of the moon

Index

Constants

View Source
const (
	Shingetsu = iota + 1
	Jougen
	Mangetsu
	Kagen
)
View Source
const (
	NewMoon = iota + 1
	FirstQuarter
	FullMoon
	LastQuarter
)
View Source
const Version = "0.0.5"

Variables

This section is empty.

Functions

func Gessou

func Gessou(t time.Time) int

Gessou returns the primary phase of the moon at time t

func Getsurei

func Getsurei(t time.Time) float64

Getsurei returns the age of the moon in days at time t

func Name

func Name(t time.Time, locale string) string

Name returns the localized name of the primary phase of the moon at time t

func Next

func Next(p int, t time.Time) time.Time

Next returns the time of the next phase p after time t

func T added in v0.0.4

func T(key, locale string) string

Types

This section is empty.

Directories

Path Synopsis
cmd
getsurei command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL