All Projects → ryannhg → date-format

ryannhg / date-format

Licence: BSD-3-Clause license
A reliable way to format dates and times in Elm.

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to date-format

Vuetify Daterange Picker
The missing date range picker for Vuetify JS you have been looking for.
Stars: ✭ 192 (+300%)
Mutual labels:  date, format, moment
format-date
📆 A small library (around 400 B when gziped & minified) to format JavaScript `Date` object using same tokens as moment.
Stars: ✭ 25 (-47.92%)
Mutual labels:  date, format, moment
vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (-60.42%)
Mutual labels:  date, format
Rc Datetime Picker
React component for datetime picker by Moment.js
Stars: ✭ 85 (+77.08%)
Mutual labels:  date, moment
Moment Range
Fancy date ranges for Moment.js
Stars: ✭ 1,639 (+3314.58%)
Mutual labels:  date, moment
Protodate
Better Javascript Dates.
Stars: ✭ 14 (-70.83%)
Mutual labels:  date, format
Dayjs
⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
Stars: ✭ 37,373 (+77760.42%)
Mutual labels:  date, moment
Time Stamp
Get a formatted timestamp. Used in gulp, assemble, generate, and many others.
Stars: ✭ 104 (+116.67%)
Mutual labels:  date, format
Date Io
Abstraction over common javascript date management libraries
Stars: ✭ 382 (+695.83%)
Mutual labels:  date, moment
jodaTime
Format and Parse date and time with joda layout
Stars: ✭ 67 (+39.58%)
Mutual labels:  date, format
lit-date
Light-weight, faster datetime formatter for modern browsers.
Stars: ✭ 33 (-31.25%)
Mutual labels:  date, format
Moment.php
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Stars: ✭ 900 (+1775%)
Mutual labels:  date, moment
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (-64.58%)
Mutual labels:  date, format
Tinydate
A tiny (349B) reusable date formatter. Extremely fast!
Stars: ✭ 990 (+1962.5%)
Mutual labels:  date, format
Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (+1016.67%)
Mutual labels:  date, moment
Date And Time
A Minimalist DateTime utility for Node.js and the browser
Stars: ✭ 99 (+106.25%)
Mutual labels:  date, format
dayjs
Extended fork of Day.js - 2KB immutable date library alternative to Moment.js
Stars: ✭ 36 (-25%)
Mutual labels:  date, moment
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 (-50%)
Mutual labels:  date, format
Gostradamus
Gostradamus: Better DateTimes for Go 🕰️
Stars: ✭ 148 (+208.33%)
Mutual labels:  date, format
timelite
String date and time utilities 🕙
Stars: ✭ 17 (-64.58%)
Mutual labels:  date, format

date-format

A reliable way to format dates and times with Elm.

Build Status

Using the elm package

elm install ryannhg/date-format

What is date-format?

If you're coming from Javascript, you might have heard of MomentJS.

MomentJS is a great library for formatting dates!

date-format has similar formatting options as Moment, but it uses Elm's awesome type system to provide human readable names, and catch typos for you at compile time!

No need to remember the difference between mm and MM and M!

A quick example

import DateFormat
import Time exposing (Posix, Zone, utc)



-- Let's create a custom formatter we can use later:


ourFormatter : Zone -> Posix -> String
ourFormatter =
    DateFormat.format
        [ DateFormat.monthNameFull
        , DateFormat.text " "
        , DateFormat.dayOfMonthSuffix
        , DateFormat.text ", "
        , DateFormat.yearNumber
        ]



-- With our formatter, we can format any date as a string!


ourTimezone : Zone
ourTimezone =
    utc



-- 2018-05-20T19:18:24.911Z


ourPosixTime : Posix
ourPosixTime =
    Time.millisToPosix 1526843861289


ourPrettyDate : String
ourPrettyDate =
    ourFormatter ourTimezone ourPosixTime

Would make ourPrettyDate return:

"May 20th, 2018" : String

Want more examples?

I've created a few more examples in the examples/ folder for this repo.

Here's how you can try them out:

  1. git clone https://github.com/ryannhg/date-format

  2. cd date-format/examples

  3. elm reactor

  4. Go to http://localhost:8000

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].