My first elm package: elm-date-format

Hey everyone!

I just released my first elm package last night!

http://package.elm-lang.org/packages/ryannhg/elm-date-format/latest

This is my first attempt at creating something for the community, and I’d love to get your feedback!

There are a few other solutions out there that do date formatting in elm, including the impressive rluiten/elm-date-extra package.

But elm-date-format is a small package, focused on using union types (instead of strings) to reliably format dates.

Last night, the #api-design channel in slack suggested I should follow the Literal Names Policy.

This led to me renaming elm-moment to elm-date-format, which definitely makes a lot more sense! (Thanks Ian!)

Feel free to check it out, and leave any other feedback you might have!

And here’s an Ellie, made possible by the legendary Luke Westby: https://ellie-app.com/ktHHXBrMma1/2

Thanks,
Ryan

16 Likes

This looks really nice! I really like the idea of a fully type-checked date format, instead of just resorting to strings.

One feature I like in moment is the ability to do "relative" time. It would be a cool addition to see, but I imagine it could be a challenge due to i18n?

1 Like

I think relative time would be an awesome addition to the package!

I think my next steps are to use elm-test tonight, so i can verify this stuff actually works haha.

I’ll keep you guys posted!

1 Like

Nice work :slight_smile: I poked around for a bit and it seems to do what you’d expect, pretty straight forward. I’ll use it next time I need a date format.

1 Like

Very nice, I can never tell what something like %a %e %B stands for.
I really like the idea of using types for this.

1 Like

Super excited about this- Can’t wait to use it! Thanks for sharing and great work!

Also, I’ve been missing MonthSuffix so badly! :heart_eyes:

1 Like