GithubHelp home page GithubHelp logo

dokutan / explain8601 Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 103 KB

Convert an ISO 8601 expression to a human readable description

License: GNU Affero General Public License v3.0

Clojure 100.00%
iso8601

explain8601's Introduction

explain8601

Convert an ISO 8601 expression to a human readable description. ISO 8601-1:2019, ISO 8601-1:2019/Amd 1:2022 and parts of ISO 8601-2:2019 are supported, older versions of the standard and RFC 3339 are not supported.

Installation

You can download a release as a jar file from the GitHub releases page. Alternatively see the build section below.

Usage

The basic usage is

$ java -jar explain8601-0.1.0-standalone.jar [opts] -e expression

Use the -d option to show the intermediate results of the conversion.

Build

Clojure and Leiningen are required to build a jar file, after cloning this repo run:

$ lein uberjar

Test

Run all tests with

$ lein test

GraalVM native image

Additionally building a native binary using GraalVM is possible:

$ export GRAALVM_HOME=/usr/lib/jvm/java-17-graalvm/bin # this path depends on your GraalVM installation
$ $GRAALVM_HOME/gu install native-image # install the native image component
$ lein native-image

Examples

The following is a list of generated descriptions:

  • '2022-22' represents the summer of 2022.
  • '2022/2023' represents an interval from the year 2022 to the year 2023.
  • 'P1YP2W' represents a duration of 1 year and 2 weeks.
  • 'R2/2022-123T00:00/PT1H' represents an interval from the 123rd day of the year 2022 at 0 minutes past 0 hours, lasting for a duration of 1 hour, repeating 2 times.
  • '2022Y7M30~DT1S' represents the 30th day (approximate) of july of the year 2022 at 1 second past 0 hours.

Bugs

Not all features from ISO 8601-2:2019 are supported, missing are e.g.:

  • grouped units
  • selection rules
  • ranges (..)

Expressions are currently not completely validated, it is therefore easy to produce accepted but invalid expressions.

Further information

https://en.wikipedia.org/wiki/ISO_8601

freely available related standards:

License

AGPLv3

explain8601's People

Contributors

dokutan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

din-dke

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.