https://github.com/g-30/chrono_dart
A natural language date parser in Dart. Inspired by @wanasit/chrono.
https://github.com/g-30/chrono_dart
android dart date-parser date-parsing datetime flutter ios
Last synced: about 2 months ago
JSON representation
A natural language date parser in Dart. Inspired by @wanasit/chrono.
- Host: GitHub
- URL: https://github.com/g-30/chrono_dart
- Owner: g-30
- License: other
- Created: 2023-09-29T18:04:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-13T16:19:07.000Z (over 1 year ago)
- Last Synced: 2025-10-22T23:11:49.481Z (6 months ago)
- Topics: android, dart, date-parser, date-parsing, datetime, flutter, ios
- Language: Dart
- Homepage: https://pub.dev/packages/chrono_dart
- Size: 107 KB
- Stars: 15
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Chrono - Date parser for Dart (Flutter)
[](https://pub.dev/packages/chrono_dart)
[](https://opensource.org/licenses/MIT)
A natural language date parser in Dart. Finds and extracts dates from user-generated text content.
Example use case – WhatsApp-like date parsing in dialogues:

It is designed to handle most date/time formats and extract information from any given text:
* Today, Tomorrow, Yesterday, Last Friday, etc
* 17 August 2013 - 19 August 2013
* This Friday from 13:00 - 16.00
* 5 days ago
* 2 weeks from now
* Sat Aug 17 2013 18:40:39 GMT+0900 (JST)
* 2014-11-30T08:15:30-05:30
# Usage
1. Install manually or via pub - `dart pub add chrono_dart`
2. Simply pass a string to functions Chrono.parseDate or Chrono.parse.
```dart
import 'package:chrono_dart/chrono_dart.dart' show Chrono;
Chrono.parseDate('An appointment on Sep 12');
// DateTime('2023-09-12 12:00:00.000Z')
Chrono.parse('An appointment on Sep 12');
/* [{
index: 18,
text: 'Sep 12',
date() => DateTime('2023-09-12T12:00:00'),
...
}] */
```
Only English is supported in this version. Feel free to add PRs with any other languages – the package is designed with extendability in mind.
-----------
Port of Chrono to Dart lang.
For extended API information see [the original package](https://github.com/wanasit/chrono/).