Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abadi199/dateparser
Custom Date Parser in Elm
https://github.com/abadi199/dateparser
date elm parser
Last synced: 23 days ago
JSON representation
Custom Date Parser in Elm
- Host: GitHub
- URL: https://github.com/abadi199/dateparser
- Owner: abadi199
- License: apache-2.0
- Created: 2017-02-24T13:47:50.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-07T18:46:57.000Z (almost 7 years ago)
- Last Synced: 2024-12-17T11:46:53.294Z (25 days ago)
- Topics: date, elm, parser
- Language: Elm
- Homepage: http://package.elm-lang.org/packages/abadi199/dateparser/latest
- Size: 48.8 KB
- Stars: 5
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Date Parser
Custom Date Parser in Elm
This package is intended to work alongside with [rluiten/elm-date-extra](package.elm-lang.org/packages/rluiten/elm-date-extra/latest)## Format
This library uses the date format pattern from: [https://github.com/rluiten/elm-date-extra/blob/8.2.0/DocFormat.md](https://github.com/rluiten/elm-date-extra/blob/8.2.0/DocFormat.md)- %Y - 4 digit year, zero-padded
- %m - Zero-padded month of year, e.g. "07" for July
- %_m - Space-padded month of year, e.g. " 7" for July
- %-m - Month of year, e.g. "7" for July
- %B - Full month name, e.g. "July"
- %^B - Uppercase full month name, e.g. "JULY"
- %b - Abbreviated month name, e.g. "Jul"
- %^b - Uppercase abbreviated month name, e.g. "JUL"
- %d - Zero-padded day of month, e.g "02"
- %-d - Day of month, e.g "2"
- %-@d - Day of Month with language idiom suffix Day of month, e.g "2nd"
- this currently only does this in english language
- %e - Space-padded day of month, e.g " 2"
- %@e - Space-padded Day of Month with language idiom suffix, e.g " 2nd"
- this currently only does this in english language
- %A - Day of week in full, e.g. "Wednesday"
- %^A - Uppercase Day of week in full, e.g. "WEDNESDAY"
- %a - Day of week, abbreviated to three letters, e.g. "Wed"
- %^a - Uppercase day of week, abbreviated to three letters, e.g. "WED"
- %H - Hour of the day, 24-hour clock, zero-padded
- %-H - Hour of the day, 24-hour clock, no padding
- %k - Hour of the day, 24-hour clock, space-padded
- %I - Hour of the day, 12-hour clock, zero-padded
- %-I - Hour of the day, 12-hour clock, no padding
- %l - (lower ell) Hour of the day, 12-hour clock, space-padded
- %p - AM or PM
- %P - am or pm
- %M - Minute of the hour, zero-padded
- %S - Second of the minute, zero-padded
- %L - Milliseconds of a second, length 3 zero-padded
- %z - time zone offset format "(+/-)HHMM"
- %:z - time zone offset format "(+/-)HH:MM"
- %% - produces a %## Example:
```elm
DateParser.parse Date.Extra.Config.Config_en_us "%d/%m/%Y" "31/12/2017"
DateParser.parse Date.Extra.Config.Config_en_us "%d/%m/%Y %I:%M %P" "31/12/2017 09:30 AM"
```## Development info
Running tests:
```sh
npm install
npm test
```