BenMakesGames.MoonMath 1.0.0

Prefix Reserved
dotnet add package BenMakesGames.MoonMath --version 1.0.0                
NuGet\Install-Package BenMakesGames.MoonMath -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BenMakesGames.MoonMath" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BenMakesGames.MoonMath --version 1.0.0                
#r "nuget: BenMakesGames.MoonMath, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BenMakesGames.MoonMath as a Cake Addin
#addin nuget:?package=BenMakesGames.MoonMath&version=1.0.0

// Install BenMakesGames.MoonMath as a Cake Tool
#tool nuget:?package=BenMakesGames.MoonMath&version=1.0.0                

What Is It?

BenMakesGames.MoonMath is a small library that adds extensions to DateTime and DateTimeOffset to calculate the phase of the Moon.

Buy Me a Coffee at ko-fi.com

How to Use

Install

dotnet add package BenMakesGames.MoonMath 

Add using

using BenMakesGames.MoonMath;

Reference

double DateTimeOffset.GetMoonAge()

Computes The Moon's "age" - the number of Earth days since the last new moon. Ranges from 0 to ~29.53.

Example Use
var now = new DateTimeOffset();

Console.WriteLine($"It has been {now.GetMoonAge()} days since the last new moon.");

MoonPhase DateTimeOffset.GetMoonPhase()

Returns a MoonPhase indicating the current phase of the Moon. MoonPhase has the following values:

  • NewMoon
  • WaxingCrescent
  • FirstQuarter
  • WaxingGibbous
  • FullMoon
  • WaningGibbous
  • ThirdQuarter
  • WaningCrescent
Example Use
var now = new DateTimeOffset();

var moonPhase = now.GetMoonPhase();

double DateTime.GetMoonAge()

Same as DateTimeOffset.GetMoonAge, but for DateTimes.

MoonPhase DateTime.GetMoonPhase()

Same as DateTimeOffset.GetMoonPhase, but for DateTimes.

string MoonPhase.ToEmoji()

Returns the emoji for the given MoonPhase:

  • 🌑 NewMoon
  • 🌒 WaxingCrescent
  • 🌓 FirstQuarter
  • 🌔 WaxingGibbous
  • 🌕 FullMoon
  • 🌖 WaningGibbous
  • 🌗 ThirdQuarter
  • 🌘 WaningCrescent
Example use:
var now = new DateTimeOffset();

Console.WriteLine(now.GetMoonPhase().ToEmoji());
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 195 7/9/2023