SkillAgentSearch skills...

Jchronic

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

Install / Use

/learn @samtingleff/Jchronic
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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.

View on GitHub
GitHub Stars127
CategoryDevelopment
Updated11d ago
Forks28

Languages

Java

Security Score

95/100

Audited on Mar 22, 2026

No findings