edtfy is a parser that transforms user input into the edtf format.
npm install edtfy #npm
bower install edtfy #bower
edtfy = require('edtfy');
edtfy.locale('fr');
edtfy('29 mars 1988'); // 1988-03-29
edtfy.locale(locale)
: define the locale
edtfy.locale()
: retrieve the locale
input | output |
---|---|
2008 | 2008 |
december 1988 | 2008-12 |
02/03/1988 | 2001-02-03 |
Not supported for now.
input | output |
---|---|
from 1964 to 2008 | 1964/2008 |
June 2004 - August 2008 | 2004-06/2008-08 |
2/1/2004 / 2/8/2005 | 2004-02-01/2008-02-08 |
02/01/2004-2005 | 2004-02-01/2005 |
from 2005 to June 2006 | 2005/2006-02 |
input | output |
---|---|
1984? | 1984? |
June 2004? | 2004-06? |
June the 11th, 2004? | 2004-06-11? |
around 1984 | 1984~ |
about 1984? | 1984?~ |
input | output |
---|---|
199u | 199u |
1999-uu | 1999-uu |
1999-01-uu | 1999-01-uu |
1999-uu-uu | 1999-uu-uu |
input | output |
---|---|
from 06/01/2004 to unknown | 2004-06-01/unknown |
from 01/01/2004 to open | 2004-01-01/open |
from around 1984 to June 2004 | 1984~/2004-06 |
1984 - around June 2004 | 1984/2004-06~ |
1984? - ~2004? | 1984?/2004?~ |
input | output |
---|---|
170000002 | y170000002 |
-170000002 | y-170000002 |
input | output |
---|---|
Spring 2001 | 2001-21 |
Not supported for now.
input | output |
---|---|
12/25/156u | 156u-12-25 |
12/25/156uu | 15uu-12-25 |
12/uu/15uu | 15uu-12-uu |
uu/25/1560 | 1560-uu-25 |
The ..
feature is only supported of before
and after
for now.
input | output |
---|---|
1667 or 1668 or 1670 | [1667,1668,1670] |
Jan 1760 or Feb 1760 or December 1760 | [1760-01,1760-02,1760-12] |
1667 or 12/1760 | [1667,1760-12] |
before 1930 | [..,1930] |
after march 2004 | [2004-03,..] |
The ..
feature is not supported for now.
input | output |
---|---|
1667 and 1668 and 1670 | {1667,1668,1670} |
1960 and December 1961 | {1960,1961-12} |
input | output |
---|---|
196x | 196x |
19xx | 19xx |
Not supported for now.
MIT © Nicolas Barbotte