Git Product home page Git Product logo

elm-iso8601-date-strings's Introduction

elm-iso8601

Convert ISO-8601 date strings into POSIX times.

This package takes the view that it is a mistake to use ISO-8601 strings as a data transfer format. Nevertheless, third-party endpoints may use them, so even if we'd rather avoid them, sometimes they may be unavoidable.

The only design goal of this package is to "correct the mistake" by translating ISO-8601 strings to and from Time.Posix values. If it encounters a UTC offset in the string, it normalizes and discards it such that the resulting Time.Posix value is in UTC no matter what.

That's all this package does, and all it aims to do!

Why are integers better?

Integer milliseconds since the epoch is a better choice for data transfer because ISO-8601 strings can potentially include a UTC offset.

This is much worse than not having the possibility of including a UTC offset. Consider:

  • UTC offsets are not time zones. This does not and cannot tell us the time zone in which the date was recorded. So what are we supposed to do with this information?
  • Users typically want dates formatted according to their local time zone. What if the provided UTC offset is different from the current user's time zone? What are we supposed to do with it then?
  • Despite it being useless (or worse, a source of bugs), the UTC offset creates a larger payload to transfer.

Even without the UTC offset, an ISO-8601 string is still much larger to transfer than an integer. The usual argument in favor of ISO-8601 strings is that they are more human-readable than integers, but making data readable for humans is a better job for developer tools than data transfer formats between machines.

elm-iso8601-date-strings's People

Contributors

reiner-dolp avatar justinmimbs avatar gyzerok avatar methodgrab avatar

Watchers

Tom Stejskal avatar James Cloos 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.