jchronic

Natural language date parsing in Java, ported directly from Ruby's chronic

License

License

GroupId

GroupId

com.rubiconproject.oss
ArtifactId

ArtifactId

jchronic
Last Version

Last Version

0.2.8
Release Date

Release Date

Type

Type

jar
Description

Description

jchronic
Natural language date parsing in Java, ported directly from Ruby's chronic
Project URL

Project URL

http://github.com/samtingleff/jchronic
Source Code Management

Source Code Management

http://github.com/samtingleff/jchronic

Download jchronic

How to add to project

<!-- https://jarcasting.com/artifacts/com.rubiconproject.oss/jchronic/ -->
<dependency>
    <groupId>com.rubiconproject.oss</groupId>
    <artifactId>jchronic</artifactId>
    <version>0.2.8</version>
</dependency>
// https://jarcasting.com/artifacts/com.rubiconproject.oss/jchronic/
implementation 'com.rubiconproject.oss:jchronic:0.2.8'
// https://jarcasting.com/artifacts/com.rubiconproject.oss/jchronic/
implementation ("com.rubiconproject.oss:jchronic:0.2.8")
'com.rubiconproject.oss:jchronic:jar:0.2.8'
<dependency org="com.rubiconproject.oss" name="jchronic" rev="0.2.8">
  <artifact name="jchronic" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.rubiconproject.oss', module='jchronic', version='0.2.8')
)
libraryDependencies += "com.rubiconproject.oss" % "jchronic" % "0.2.8"
[com.rubiconproject.oss/jchronic "0.2.8"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

jchronic

Introduction

A natural language date parser in Java. Originally written by Mike Schrag as a direct port of Ruby's chronic.

I've forked it out of WONDER, "an umbrella project for the WebObjects community."

Maven

<dependencies>
    <dependency>
        <groupId>com.rubiconproject.oss</groupId>
        <artifactId>jchronic</artifactId>
        <version>0.2.8</version>
    </dependency>
</dependencies>

Parsing of two-digit years

The parsing of two-digit years can be controlled with one of the Pointer.PointerType values NONE, PAST or FUTURE like this:

Options opts = new Options(Pointer.PointerType.PAST);
Span result = Chronic.parse("1/2/38", options);   // Year is treated as 1938 because of PointerType.PAST.

The behavior is like this:

PointerType 1-19 20-37 38-68 69-99 100-137
NONE 20xx 20xx error 19xx 20xx
PAST 20xx 19xx 19xx 19xx 20xx
FUTURE 20xx 20xx 20xx 19xx 20xx

Earlier versions of this library ignored the given options and always behaved like the NONE line in the table.

Credits

This was originally written by Mike Schrag as part of the WONDER project.

Additional contributions have since been made by @brianm, @ewanmellor, and @samtingleff.

License

The MIT license. See LICENSE.

Versions

Version
0.2.8
0.2.7
0.2.6