Skip to content

or-equals/sun_dial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SunDial

Date and Time Helpers for Elixir

Installation

If available in Hex, the package can be installed by adding sun_dial to your list of dependencies in mix.exs:

def deps do
  [
    {:sun_dial, "~> 0.5.1"}
  ]
end

Usage

# Formatting
SunDial.format_month(3) == "March"
SunDial.format_date(~D[2020-11-01]) == "11/1/2020"
SunDial.format_date(~N[2021-02-17 00:00:23]) == "2/17/2021"
SunDial.short_date(~N[2021-02-17 00:00:23]) == "Feb 2021"

# Transformation
SunDial.utc_today_with_offset(0) == today
SunDial.utc_today_with_offset(1) == tomorrow
SunDial.utc_today_with_offset(-1) == yesterday
SunDial.naive_utc_today_with_offset(86400) == tomorrow_as_naive_date_time # offset is in seconds, 86400 seconds in a day

SunDial.from_iso8601("2022-09-18") == ~D[2022-09-18]
SunDial.format_iso8601_date("2022-09-18") == "9/18/2022"

About

Date and Time Helpers for Elixir

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages