Giter Club home page Giter Club logo

exdate's Introduction

ExDate

ExDate is an Elixir implementation of the universal Date/Time parser ec_date.

Currently it only the parser (String -> {{Year, Month, Day}, {Hour, Minute, Second}}) is implemented.

Current Status

Build Status

Usage

Add ExDate as a dependeny in your mix.exs file.

defp deps do
  [{:ex_date, github: "l3kn/ExDate"}]
end

And run mix deps.get in your shell to fetch the dependencies.

iex> ExDate."Sat 22nd of August 2008")
{{2008,8,22},{17,16,17}}
# {{year, month, day}, {hour, minute, second}}

Supported formats

  • ISO 8601
  • RFC 1123
  • Gregorian, day-month-year
  • Gregorian, year-month-day
  • Gregorian, month-day-year
  • Times (hh:mm:ss, hh:mm, hh)

Examples

  "22nd of August 2008"
  "22-Aug-2008 6 AM"
  "August/22/2008 6:35 AM"
  "22 August 2008 6:35 AM"
  "22 Aug 2008 6:35 AM"
  "August 22nd, 2008, 6:15:15pm"
  "Aug 22nd 2008, 18:15"
  "2nd of August 2008"
  "August 2nd, 2008"
  "2nd  August, 2008"
  "2008 August 2nd"
  "2-Aug-2008 6:35:12 AM"
  "2 August 2008 6:35 AM"
  "2 Aug 2008 6:35 AM"
  "2 Aug 2008 6 PM"
  "Aug 2, 2008 6 PM"
  "August 2nd, 2008 6:00 PM"
  "Dec 10th, 2012, 12:00 AM"
  "10 Dec 2012 12:00 AM"
  "23-4-1963"
  "11:15"
  "1:15"
  "1:15 am"
  "12:15 am"
  "12:15 pm"
  "3:45:39"
  "Monday 22 Aug 2008 6"
  "Monday 22 Aug 2008 6p"
  "Monday 22 Aug 2008 6a"
  "Mon, 22 Aug 2008 6:35 PM"

See test/ex_date_test.exs for more.

TODO

  • Support structs as alternative to erlang dates
  • Handle overflows like 23:00+10
  • Add support for timezones
  • Implement the formater

Credits

exdate's People

Watchers

 avatar  avatar

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.