All Projects → justinmimbs → elm-date-extra

justinmimbs / elm-date-extra

Licence: other
Extra functions for working with Date

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to elm-date-extra

date-php
这是一个Javascript模仿PHP日期时间格式化函数,使用方法和PHP非常类似,有丰富的模板字符,并在原来的基础上增加了一些模板字符。 This is a date function that implement PHP in Javascript. It is very similar to PHP, has rich template characters, and enhances some template characters on the basis of the original.
Stars: ✭ 24 (-41.46%)
Mutual labels:  date, date-format
Caterpillar
🐛 Caterpillar: Type-safe date formats in Swift, no more "yyyy-MM-dd'T'HH:mm:ssZ"
Stars: ✭ 49 (+19.51%)
Mutual labels:  date, date-format
format-date
📆 A small library (around 400 B when gziped & minified) to format JavaScript `Date` object using same tokens as moment.
Stars: ✭ 25 (-39.02%)
Mutual labels:  date, date-format
datium
⏰ The flexible DataTime Package written in PHP
Stars: ✭ 18 (-56.1%)
Mutual labels:  date-format, date-parser
Timespace
A jQuery plugin to handle displaying of time events
Stars: ✭ 27 (-34.15%)
Mutual labels:  date
dateparser
dateparser is a smart and high-performance date parser library, it supports hundreds of different formats, nearly all format that we may used. And this is also a showcase for "retree" algorithm.
Stars: ✭ 80 (+95.12%)
Mutual labels:  date
hawking
A Natural Language Date Time Parser that Extract date and time from text with context and parse to the required format
Stars: ✭ 168 (+309.76%)
Mutual labels:  date-parser
iso8601
A fast ISO8601 date parser for Go
Stars: ✭ 122 (+197.56%)
Mutual labels:  date
go-prettytime
Format GoLang dates in a “pretty” way. ex : just now, a minute ago, 2 hours ago , 3 minutes ago
Stars: ✭ 23 (-43.9%)
Mutual labels:  date
temps-lite
A smart, good-looking little app which tries to speak your language the way you are used to.
Stars: ✭ 40 (-2.44%)
Mutual labels:  date
date-extractor
Extract dates from text
Stars: ✭ 58 (+41.46%)
Mutual labels:  date
lit-date
Light-weight, faster datetime formatter for modern browsers.
Stars: ✭ 33 (-19.51%)
Mutual labels:  date
thai-date
Display date in Thai use same PHP date() and strftime() function attributes.
Stars: ✭ 14 (-65.85%)
Mutual labels:  date
react-modern-datepicker
A modern date picker for react library
Stars: ✭ 19 (-53.66%)
Mutual labels:  date
time machine
A date and time API for Dart
Stars: ✭ 120 (+192.68%)
Mutual labels:  date
jodaTime
Format and Parse date and time with joda layout
Stars: ✭ 67 (+63.41%)
Mutual labels:  date
ISO8601
🎗 Super lightweight ISO8601 Date Formatter in Swift
Stars: ✭ 20 (-51.22%)
Mutual labels:  date
persiantools
Jalali date and datetime with other tools
Stars: ✭ 101 (+146.34%)
Mutual labels:  date
Chocobo-Date-Range-Picker
🗓️ Component - The Date Range Picker easier to use in AngularJS.
Stars: ✭ 23 (-43.9%)
Mutual labels:  date
duration
Parse iso8601 duration strings, and use to shift dates/times.
Stars: ✭ 51 (+24.39%)
Mutual labels:  date

elm-date-extra

Extra functions for working with the Date type from the Elm 0.18 core library.

Upgrading to Elm 0.19?

The Date module from Elm 0.18 core was replaced by the library elm/time, where the Date type is now replaced by Zone and Posix types. A subset of this package has been ported to work with Zone and Posix:

Most of the remaining features of this package can be found in these Elm 0.19 packages that work with Posix:

And if you only need to work with dates, without clock time or time zones, then this Date type is available for Elm 0.19:

Installation

elm-package install justinmimbs/elm-date-extra

Changelog

See the changelog before upgrading.

Examples

Only examples of common uses are given below; see the docs for the full API.

Create

Create dates from parts.

import Date exposing (Month(..))
import Date.Extra as Date

Date.fromParts 1999 Dec 31 23 59 0 0
-- <31 December 1999, 23:59, local time>

Create dates from strings in ISO 8601 format.

Date.fromIsoString "2000-01-01T00:00:00.000"
-- Ok <1 January 2000, local time>

Date.fromIsoString "2009-W01-1T00Z"
-- Ok <29 December 2008, UTC>

Date.fromIsoString "2016-218T20:00:00.000-03:00"
-- Ok <5 August 2016, 23:00, UTC>

Create a date from a specified day, time of day, and time offset.

Date.fromSpec
  (calendarDate 2016 Aug 5)
  (time 20 0 0 0)
  (offset -180)
-- <5 August 2016, 23:00, UTC>

Format

Convert dates to formatted strings, using templates based on Date Format Patterns in Unicode Technical Standard #35.

date = Date.fromParts 2007 Mar 15 13 45 56 67

Date.toFormattedString "EEEE, MMMM d, y 'at' h:mm a" date
-- "Thursday, March 15, 2007 at 1:45 PM"

Date.toUtcIsoString date
-- "2007-03-15T17:45:56.067Z"
-- (example has a local offset of UTC-04:00)

Operate

Operate on the numeric properties of dates.

import Date exposing (Month(..))
import Date.Extra as Date exposing (Interval(..))

date = Date.fromParts 1999 Dec 31 23 59 59 999

Date.add Week -2 date
-- <17 December 1999, 23:59:59.999>

Date.diff Day date (Date.add Week 2 date)
-- 14

Date.floor Hour date
-- <31 December 1999, 23:00>

Date.ceiling Monday date
-- <3 January 2000, 00:00>

-- List every Monday in the month of `date`:
Date.range Monday 1
  (Date.floor Month date)   -- <1 December 1999>
  (Date.ceiling Month date) -- <1 January 2000>
-- [ <6 December 1999>
-- , <13 December 1999>
-- , <20 December 1999>
-- , <27 December 1999>
-- ]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].