Git Product home page Git Product logo

chronology's Introduction

Chronology

This is a simple wrapper around Timex to get date ranges for humanized references, such as last week, past year etc.

Installation

def deps do
  [
    {:chronology, github: "audian/chronology"}
  ]
end

Usage

iex> Chronology.range(:past_year)
{:ok,
 %{
   finish: ~U[2021-06-21 22:06:41.036959Z],
   start: ~U[2020-06-21 22:06:41.036641Z]
 }}

 iex> Chronology.range(:past_month)
{:ok,
 %{
   finish: ~U[2021-06-21 22:06:36.181093Z],
   start: ~U[2021-05-21 22:06:36.180699Z]
 }}

Time Periods

time period Period description
:today Today
:yesterday Yesterday
:this_week The current week
:this_month The current month
:this_year The current year
:this_quarter The current quarter
:last_week The last week (Mon-Sun)
:last_month The last full month
:last_year The last full year
:last_quarter The last quarter
:past_week Past 7 days
:past_month Past month (date to date)
:past_year Past 365 days
:previous_year 2 years ago

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.