Skip to content

A natural language date/time parser for .NET Standard

License

Notifications You must be signed in to change notification settings

robbell/nChronic.Core

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nChronic.Core

Introduction

A natural language date parser for .Net Standard written in C#. Originally written by Mike Schrag as a direct port of Ruby's Chronic, later ported to .NET by Robert Wilczynski, and finally migrated to .NET Standard by Rob Bell.

Usage

DateTime.Now; 
  //=> Sun Aug 27 23:18:25 PDT 2006

var parser = new Parser();
parser.Parse("tomorrow");
  // => Mon Aug 28 12:00:00 PDT 2006

// Setting context
parser = new Parser(new Options { Context = Pointer.Type.Past });
parser.Parse("monday");
  // => Mon Aug 21 12:00:00 PDT 2006

parser = new Parser(new Options { Clock = () => new DateTime(2000, 1, 1)});
parser.Parse("may 27th");
  // => Sat May 27 12:00:00 PDT 2000

Installation

.NET Core

dotnet add package Chronic.Core

.NET Framework

Install-Package Chronic.Core

Credits

This is a port of https://github.com/mojombo/chronic inspired by https://github.com/samtingleff/jchronic. Please see those projects for further credits.

License

Unless specified otherwise all is licensed under the MIT license. See LICENSE for details. Logo is the creation of Alexander Moore and is licensed under the GNU/GPL license (via http://findicons.com/icon/232550/clock).

Packages

No packages published

Languages

  • C# 99.8%
  • Shell 0.2%