edtf 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,24 +8,34 @@ Specification](http://www.loc.gov/standards/datetime/spec.html).
8
8
  Compatibility
9
9
  -------------
10
10
 
11
- EDTF-Ruby parser fully implements all levels and features of EDTF
12
- Specification DRAFT, August 4, 2011.
11
+ EDTF-Ruby parser implements all levels and features of the EDTF Specification
12
+ (version September 16, 2011). With the following known caveats:
13
+
14
+ * Uncertain/approximate seasons will be parsed, but the Season class does
15
+ not implement attributes.
16
+ * Some complex L2 partial uncertain/approximate date strings may currently
17
+ fail to parse.
13
18
 
14
19
  The level 2 list extensions (203 and 204) currently return simple Ruby arrays;
15
20
  therefore, advanced behavior (such as 'earlier' or 'later') is parsed correctly
16
21
  but not yet exposed by the Ruby API.
17
22
 
18
23
  EDTF-Ruby has been confirmed to work on the following Ruby implementations:
19
- 1.9.2, 1.8.7, Rubinius, and JRuby.
24
+ 1.9.3, 1.9.2, 1.8.7, Rubinius, and JRuby. Active Support's date extensions
25
+ are currently listed as a dependency, because of a number of many functional
26
+ overlaps.
20
27
 
21
28
 
22
29
  Quickstart
23
30
  ----------
24
31
 
25
32
  EDTF Ruby is implemented as an extension to the regular Ruby date/time classes.
26
- You can access parse EDTF strings either using `Date.edtf` or `EDTF.parse`; if
33
+ You can access parse EDTF strings either using `Date.edtf` or `EDTF.parse`
34
+ (both methods come with an alternative bang! version, that will raise an error
35
+ if the string cannot be parsed instead of silently returning nil); if
27
36
  given a valid EDTF string the return value will either be an (extended) `Date`,
28
- `EDTF::Interval` or `Range` (for masked precision strings) instance.
37
+ `EDTF::Interval` or `Range` (for masked precision strings) instance. Given
38
+ a Date, you can print the corresponding EDTF string using the `#edtf` method.
29
39
 
30
40
  $ [sudo] gem install edtf
31
41
  $ irb
@@ -33,9 +43,9 @@ given a valid EDTF string the return value will either be an (extended) `Date`,
33
43
  > d = Date.edtf('1984?')
34
44
  > d.uncertain?
35
45
  => true
36
- > d.certain!
37
- > d.uncertain?
38
- => false
46
+ > d.approximate!
47
+ > d.edtf
48
+ => "1984?~"
39
49
  > d = Date.edtf('1999-03-uu')
40
50
  > d.unspecified?
41
51
  => true
@@ -43,37 +53,57 @@ given a valid EDTF string the return value will either be an (extended) `Date`,
43
53
  => false
44
54
  > d.unspecified? :day
45
55
  => true
46
- > Date.edtf('2003-24').winter?
56
+ > d.unspecified! :month
57
+ > d.edtf
58
+ => "1999-uu-uu"
59
+ > Date.edtf!('2003-24').winter?
47
60
  => true
48
- > Date.edtf('196x')
61
+ > Date.edtf!('196x')
49
62
  => #<Date: 1960-01-01>...#<Date: 1970-01-01>
50
63
  > Date.edtf('y-17e7').year
51
64
  => -170000000
52
65
  > d = Date.edtf('1984-06?/2004-08?')
53
66
  > d.from.uncertain?
54
67
  => true
55
- > d.to_a.length
56
- => 7397 # days between 1984-06-01 and 2004-08-31
57
- > Date.edtf('1582-10/1582-10').to_a.length
68
+ > d.include?(Date.new(1987,04,13))
69
+ => false # the day is not included because interval has month precision
70
+ > d.cover?(Date.new(1987,04,13))
71
+ => true # but the day is still covered by the interval
72
+ > d.length
73
+ => 243 # months between 1984-06-01 and 2004-08-31
74
+ > d.step(36).map(&:year)
75
+ => [1984, 1987, 1990, 1993, 1996, 1999, 2002] # 36-month steps
76
+ > Date.edtf('1582-10-01/1582-10-31').length
58
77
  => 21 # number of days in October 1582 (Gregorian calendar)
59
78
  > Date.edtf('2004/open').open?
60
79
  => true
61
-
80
+ > Date.edtf('2004/open').cover?(Date.today)
81
+ => true # an open ended interval covers today
62
82
 
63
- For additional features take a look at the RDoc and RSpec examples.
83
+ For additional features take a look at the documentation or the extensive
84
+ list of rspec examples.
64
85
 
65
86
 
66
- Development
67
- -----------
87
+ Contributing
88
+ ------------
89
+
90
+ The EDTF-Ruby source code is [hosted on GitHub](https://github.com/inukshuk/edtf-ruby).
91
+ You can check out a copy of the latest code using Git:
92
+
93
+ $ git clone https://github.com/inukshuk/edtf-ruby.git
94
+
95
+ To get started, generate the parser and run all tests:
68
96
 
69
- $ git clone https://inukshuk@github.com/inukshuk/edtf-ruby.git
70
97
  $ cd edtf-ruby
71
98
  $ bundle install
72
99
  $ bundle exec rake racc_debug
73
100
  $ bundle exec rspec spec
74
101
  $ bundle exec cucumber
75
102
 
76
- For extra credit, fork the project on GitHub: pull requests welcome!
103
+ If you've found a bug or have a question, please open an issue on the
104
+ [EDTF-Ruby issue tracker](https://github.com/inukshuk/edtf-ruby). Or, for extra
105
+ credit, clone the EDTF-Ruby repository, write a failing example, fix the bug
106
+ and submit a pull request.
77
107
 
78
108
 
79
109
  Credits
data/edtf.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.email = ['http://sylvester.keil.or.at']
13
13
  s.homepage = 'http://inukshuk.github.com/edtf-ruby'
14
14
  s.summary = 'Extended Date/Time Format for Ruby.'
15
- s.description = 'An Extended Date/Time Format (EDTF) Parser for Ruby.'
15
+ s.description = 'A Ruby implementation of the Extended Date/Time Format (EDTF).'
16
16
  s.license = 'FreeBSD'
17
17
 
18
18
  s.add_runtime_dependency('activesupport', ['~>3.0'])
@@ -63,14 +63,27 @@ Feature: EDTF parser parses date strings
63
63
 
64
64
  @201 @level2
65
65
  Scenarios: uncertain date examples from the specification
66
- | string | ~-year | ?-year | ~-month | ?-month | ~-day | ?-day |
67
- | 2004?-06-11 | no | yes | no | no | no | no |
68
- | 2004-06~-11 | yes | no | yes | no | no | no |
69
- | 2004-(06)?-11 | no | no | no | yes | no | no |
70
- | 2004-06-(11)~ | no | no | no | no | yes | no |
71
- | 2004-(06)?~ | no | no | yes | yes | no | no |
72
- | 2004-(06-11)? | no | no | no | yes | no | yes |
73
- | 2004?-06-(11)~ | no | yes | no | no | yes | no |
74
- | (2004-(06)~)? | no | yes | yes | yes | no | no |
75
- | 2004-06-(01)~ | no | no | no | no | yes | no |
66
+ | string | ~-year | ?-year | ~-month | ?-month | ~-day | ?-day |
67
+ | 2004?-06-11 | no | yes | no | no | no | no |
68
+ | 2004-06~-11 | yes | no | yes | no | no | no |
69
+ | 2004-(06)?-11 | no | no | no | yes | no | no |
70
+ | 2004-06-(11)~ | no | no | no | no | yes | no |
71
+ | 2004-(06)?~ | no | no | yes | yes | no | no |
72
+ | 2004-(06-11)? | no | no | no | yes | no | yes |
73
+ | 2004?-06-(11)~ | no | yes | no | no | yes | no |
74
+ | (2004-(06)~)? | no | yes | yes | yes | no | no |
75
+ | 2004-06-(01)~ | no | no | no | no | yes | no |
76
+ | (2004-(06-01)~)? | no | yes | yes | yes | yes | yes |
77
+ | (2004-(06)?-01)~ | yes | no | yes | yes | yes | no |
78
+ | 2004-06?-(01)~ | no | yes | no | yes | yes | no |
79
+ | 2004~-(06)?-01~ | yes | no | no | yes | yes | no |
80
+ | 2004~-(06-(01)~)? | yes | no | no | yes | yes | yes |
76
81
 
82
+
83
+ Scenario: Invalid dates
84
+ When I parse the following strings an error should be raised:
85
+ | xyz |
86
+ | x2009 |
87
+ | 2004-04-(1)?1 |
88
+
89
+
@@ -4,7 +4,7 @@ Feature: EDTF parses ISO 8601 interval strings
4
4
 
5
5
  Scenario Outline: parse intervals
6
6
  When I parse the string "<string>"
7
- Then the interval should include the date "<date>"
7
+ Then the interval should cover the date "<date>"
8
8
 
9
9
  @004 @level0
10
10
  Scenarios: specification intervals
@@ -1,4 +1,4 @@
1
- Feature: Print Date/Time objects as Level 1 EDTF strings
1
+ Feature: Print Date/Time objects as Level 0 EDTF strings
2
2
  As a Ruby programmer
3
3
  I want to convert Date/Time objects to EDTF strings
4
4
 
@@ -1,4 +1,4 @@
1
- Feature: Print Date/Time objects as Level 2 EDTF strings
1
+ Feature: Print Date/Time objects as Level 1 EDTF strings
2
2
  As a Ruby programmer
3
3
  I want to convert Date/Time objects to EDTF strings
4
4
 
@@ -7,9 +7,100 @@ Feature: Print Date/Time objects as Level 2 EDTF strings
7
7
  When I parse the string "2001?"
8
8
  When I convert the date
9
9
  Then the EDTF string should be "2001?"
10
+
10
11
  When I parse the string "2004-06?"
11
12
  When I convert the date
12
13
  Then the EDTF string should be "2004-06?"
14
+
13
15
  When I parse the string "2004-06-11?"
14
16
  When I convert the date
15
- Then the EDTF string should be "2004-06-11?"
17
+ Then the EDTF string should be "2004-06-11?"
18
+
19
+ When I parse the string "1984~"
20
+ When I convert the date
21
+ Then the EDTF string should be "1984~"
22
+
23
+ When I parse the string "1984?~"
24
+ When I convert the date
25
+ Then the EDTF string should be "1984?~"
26
+
27
+ @102 @level1
28
+ Scenario: Unspecified dates
29
+ When I parse the string "199u"
30
+ When I convert the date
31
+ Then the EDTF string should be "199u"
32
+
33
+ When I parse the string "19uu"
34
+ When I convert the date
35
+ Then the EDTF string should be "19uu"
36
+
37
+ When I parse the string "1999-uu"
38
+ When I convert the date
39
+ Then the EDTF string should be "1999-uu"
40
+
41
+ When I parse the string "1999-01-uu"
42
+ When I convert the date
43
+ Then the EDTF string should be "1999-01-uu"
44
+
45
+ When I parse the string "1999-uu-uu"
46
+ When I convert the date
47
+ Then the EDTF string should be "1999-uu-uu"
48
+
49
+ @103 @level1 @interval
50
+ Scenario: Prints L1 Extended Intervals
51
+ When I parse the string "unknown/2006"
52
+ When I convert the date
53
+ Then the EDTF string should be "unknown/2006"
54
+
55
+ When I parse the string "2004-06-01/unknown"
56
+ When I convert the date
57
+ Then the EDTF string should be "2004-06-01/unknown"
58
+
59
+ When I parse the string "2004-01-01/open"
60
+ When I convert the date
61
+ Then the EDTF string should be "2004-01-01/open"
62
+
63
+ When I parse the string "1984~/2004-06"
64
+ When I convert the date
65
+ Then the EDTF string should be "1984~/2004-06"
66
+
67
+ When I parse the string "1984/2004-06~"
68
+ When I convert the date
69
+ Then the EDTF string should be "1984/2004-06~"
70
+
71
+ When I parse the string "1984~/2004~"
72
+ When I convert the date
73
+ Then the EDTF string should be "1984~/2004~"
74
+
75
+ When I parse the string "1984?/2004?~"
76
+ When I convert the date
77
+ Then the EDTF string should be "1984?/2004?~"
78
+
79
+ When I parse the string "1984-06?/2004-08?"
80
+ When I convert the date
81
+ Then the EDTF string should be "1984-06?/2004-08?"
82
+
83
+ When I parse the string "1984-06-02?/2004-08-08~"
84
+ When I convert the date
85
+ Then the EDTF string should be "1984-06-02?/2004-08-08~"
86
+
87
+ When I parse the string "1984-06-02?/unknown"
88
+ When I convert the date
89
+ Then the EDTF string should be "1984-06-02?/unknown"
90
+
91
+ @104 @level1
92
+ Scenario: Prints years with more than four digits
93
+ When I parse the string "y170000002"
94
+ When I convert the date
95
+ Then the EDTF string should be "y170000002"
96
+
97
+ When I parse the string "y-170000002"
98
+ When I convert the date
99
+ Then the EDTF string should be "y-170000002"
100
+
101
+ @105 @level1 @season
102
+ Scenario: Prints seasons
103
+ When I parse the string "2001-21"
104
+ When I convert the date
105
+ Then the EDTF string should be "2001-21"
106
+
@@ -0,0 +1,31 @@
1
+ Feature: Print Date/Time objects as Level 2 EDTF strings
2
+ As a Ruby programmer
3
+ I want to convert Date/Time objects to EDTF strings
4
+
5
+ @202 @level2
6
+ Scenario: Prints internal unspecified dates
7
+ When I parse the string "156u-12-25"
8
+ When I convert the date
9
+ Then the EDTF string should be "156u-12-25"
10
+
11
+ @205 @level2 @interval
12
+ Scenario: Prints L2 extended intervals
13
+ # When I parse the string "2004-06-(01)~/2004-06-(20)~"
14
+ # When I convert the date
15
+ # Then the EDTF string should be "2004-06-(01)~/2004-06-(20)~"
16
+
17
+ When I parse the string "2004-06-uu/2004-07-03"
18
+ When I convert the date
19
+ Then the EDTF string should be "2004-06-uu/2004-07-03"
20
+
21
+ @209 @level2 @season
22
+ Scenario: Prints qualified seasons
23
+ When I parse the string "2001-21^southernHemisphere"
24
+ When I convert the date
25
+ Then the EDTF string should be "2001-21^southernHemisphere"
26
+
27
+ @207 @level2 @calendar
28
+ Scenario: Prints calendar string
29
+ When I parse the string "2001-02-03^xyz"
30
+ When I convert the date
31
+ Then the EDTF string should be "2001-02-03^xyz"
@@ -0,0 +1,134 @@
1
+ Feature: Print uncertain or approximate dates
2
+ As a Ruby programmer
3
+ I want to convert Date/Time objects to EDTF strings
4
+
5
+ @201 @level2
6
+ Scenario Outline: Prints uncertain or approximate dates
7
+ Given the date "<date>" with precision set to "<precision>"
8
+ When the year is uncertain: "<?-year>"
9
+ And the month is uncertain: "<?-month>"
10
+ And the day is uncertain: "<?-day>"
11
+ And the year is approximate: "<~-year>"
12
+ And the month is approximate: "<~-month>"
13
+ And the day is approximate "<~-day>"
14
+ When I convert the date
15
+ Then the EDTF string should be "<string>"
16
+
17
+ @wip
18
+ Scenarios: Uncertain or approximate dates, day precision
19
+ | date | precision | string | ?-year | ?-month | ?-day | ~-year | ~-month | ~-day |
20
+ | 2004-06-01 | day | 2004-06-01?~ | yes | yes | yes | yes | yes | yes |
21
+ | 2004-06-01 | day | 2004-06~-01? | yes | yes | yes | yes | yes | no |
22
+ # | 2004-06-01 | day | (2004~-06-(01)~)? | yes | yes | yes | yes | no | yes |
23
+ | 2004-06-01 | day | 2004~-06?-(01)?~ | yes | yes | yes | yes | no | yes |
24
+ | 2004-06-01 | day | 2004~-06-01? | yes | yes | yes | yes | no | no |
25
+ # | 2004-06-01 | day | (2004-(06-01)~)? | yes | yes | yes | no | yes | yes |
26
+ | 2004-06-01 | day | 2004?-(06-01)?~ | yes | yes | yes | no | yes | yes |
27
+ # | 2004-06-01 | day | (2004-(06)~-01)? | yes | yes | yes | no | yes | no |
28
+ | 2004-06-01 | day | 2004?-(06)?~-01? | yes | yes | yes | no | yes | no |
29
+ # | 2004-06-01 | day | (2004-06-(01)~)? | yes | yes | yes | no | no | yes |
30
+ | 2004-06-01 | day | 2004-06?-(01)?~ | yes | yes | yes | no | no | yes |
31
+ | 2004-06-01 | day | 2004-06-01? | yes | yes | yes | no | no | no |
32
+ | 2004-06-01 | day | 2004-06?-01~ | yes | yes | no | yes | yes | yes |
33
+ | 2004-06-01 | day | 2004-06?~-01 | yes | yes | no | yes | yes | no |
34
+ | 2004-06-01 | day | 2004~-06?-(01)~ | yes | yes | no | yes | no | yes |
35
+ | 2004-06-01 | day | 2004~-06?-01 | yes | yes | no | yes | no | no |
36
+ # | 2004-06-01 | day | 2004-(06?-01)~ | yes | yes | no | no | yes | yes | is this correct?
37
+ # | 2004-06-01 | day | 2004?-((06)?-01)~ | yes | yes | no | no | yes | yes |
38
+ | 2004-06-01 | day | 2004?-(06)?~-01~ | yes | yes | no | no | yes | yes |
39
+ # | 2004-06-01 | day | (2004-(06)~)?-01 | yes | yes | no | no | yes | no |
40
+ | 2004-06-01 | day | 2004?-(06)?~-01 | yes | yes | no | no | yes | no |
41
+ | 2004-06-01 | day | 2004-06?-(01)~ | yes | yes | no | no | no | yes |
42
+ | 2004-06-01 | day | 2004-06?-01 | yes | yes | no | no | no | no |
43
+ # | 2004-06-01 | day | (2004?-06-(01)?)~ | yes | no | yes | yes | yes | yes |
44
+ | 2004-06-01 | day | 2004?-06~-(01)?~ | yes | no | yes | yes | yes | yes |
45
+ | 2004-06-01 | day | 2004?-06~-(01)? | yes | no | yes | yes | yes | no |
46
+ | 2004-06-01 | day | 2004?~-06-(01)?~ | yes | no | yes | yes | no | yes |
47
+ | 2004-06-01 | day | 2004?~-06-(01)? | yes | no | yes | yes | no | no |
48
+ # | 2004-06-01 | day | 2004?-(06-(01)?)~ | yes | no | yes | no | yes | yes |
49
+ | 2004-06-01 | day | 2004?-(06)~-01?~ | yes | no | yes | no | yes | yes |
50
+ | 2004-06-01 | day | 2004?-(06)~-01? | yes | no | yes | no | yes | no |
51
+ | 2004-06-01 | day | 2004?-06-(01)?~ | yes | no | yes | no | no | yes |
52
+ | 2004-06-01 | day | 2004?-06-(01)? | yes | no | yes | no | no | no |
53
+ | 2004-06-01 | day | 2004?-06-01~ | yes | no | no | yes | yes | yes |
54
+ | 2004-06-01 | day | 2004?-06~-01 | yes | no | no | yes | yes | no |
55
+ | 2004-06-01 | day | 2004?~-06-(01)~ | yes | no | no | yes | no | yes |
56
+ | 2004-06-01 | day | 2004?~-06-01 | yes | no | no | yes | no | no |
57
+ | 2004-06-01 | day | 2004?-(06-01)~ | yes | no | no | no | yes | yes |
58
+ | 2004-06-01 | day | 2004?-(06)~-01 | yes | no | no | no | yes | no |
59
+ | 2004-06-01 | day | 2004?-06-(01)~ | yes | no | no | no | no | yes |
60
+ | 2004-06-01 | day | 2004?-06-01 | yes | no | no | no | no | no |
61
+ # | 2004-06-01 | day | (2004-(06-01)?)~ | no | yes | yes | yes | yes | yes |
62
+ | 2004-06-01 | day | 2004~-(06-01)?~ | no | yes | yes | yes | yes | yes |
63
+ # | 2004-06-01 | day | 2004-(06~-01)? | no | yes | yes | yes | yes | no | is this correct?
64
+ # | 2004-06-01 | day | 2004~-((06)~-01)? | no | yes | yes | yes | yes | no |
65
+ | 2004-06-01 | day | 2004~-(06)?~-01? | no | yes | yes | yes | yes | no |
66
+ # | 2004-06-01 | day | 2004~-(06-(01)~)? | no | yes | yes | yes | no | yes |
67
+ | 2004-06-01 | day | 2004~-(06)?-01?~ | no | yes | yes | yes | no | yes |
68
+ | 2004-06-01 | day | 2004~-(06-01)? | no | yes | yes | yes | no | no |
69
+ | 2004-06-01 | day | 2004-(06-01)?~ | no | yes | yes | no | yes | yes |
70
+ # | 2004-06-01 | day | 2004-((06)~-01)? | no | yes | yes | no | yes | no |
71
+ | 2004-06-01 | day | 2004-(06)?~-01? | no | yes | yes | no | yes | no |
72
+ # | 2004-06-01 | day | 2004-(06-(01)~)? | no | yes | yes | no | no | yes |
73
+ | 2004-06-01 | day | 2004-(06)?-01?~ | no | yes | yes | no | no | yes |
74
+ | 2004-06-01 | day | 2004-(06-01)? | no | yes | yes | no | no | no |
75
+ # | 2004-06-01 | day | (2004-(06)?-01)~ | no | yes | no | yes | yes | yes |
76
+ | 2004-06-01 | day | 2004~-(06)?~-01~ | no | yes | no | yes | yes | yes |
77
+ # | 2004-06-01 | day | (2004-(06)?)~-01 | no | yes | no | yes | yes | no |
78
+ | 2004-06-01 | day | 2004~-(06)?~-01 | no | yes | no | yes | yes | no |
79
+ | 2004-06-01 | day | 2004~-(06)?-01~ | no | yes | no | yes | no | yes |
80
+ | 2004-06-01 | day | 2004~-(06)?-01 | no | yes | no | yes | no | no |
81
+ # | 2004-06-01 | day | 2004-((06)?-01)~ | no | yes | no | no | yes | yes |
82
+ | 2004-06-01 | day | 2004-(06)?~-01~ | no | yes | no | no | yes | yes |
83
+ | 2004-06-01 | day | 2004-(06)?~-01 | no | yes | no | no | yes | no |
84
+ | 2004-06-01 | day | 2004-(06)?-01~ | no | yes | no | no | no | yes |
85
+ | 2004-06-01 | day | 2004-(06)?-01 | no | yes | no | no | no | no |
86
+ # | 2004-06-01 | day | (2004-06-(01)?)~ | no | no | yes | yes | yes | yes |
87
+ | 2004-06-01 | day | 2004-06~-(01)?~ | no | no | yes | yes | yes | yes |
88
+ | 2004-06-01 | day | 2004-06~-(01)? | no | no | yes | yes | yes | no |
89
+ | 2004-06-01 | day | 2004~-06-(01)?~ | no | no | yes | yes | no | yes |
90
+ | 2004-06-01 | day | 2004~-06-(01)? | no | no | yes | yes | no | no |
91
+ # | 2004-06-01 | day | 2004-(06-(01)?)~ | no | no | yes | no | yes | yes |
92
+ | 2004-06-01 | day | 2004-(06)~-01?~ | no | no | yes | no | yes | yes |
93
+ | 2004-06-01 | day | 2004-(06)~-01? | no | no | yes | no | yes | no |
94
+ | 2004-06-01 | day | 2004-06-(01)?~ | no | no | yes | no | no | yes |
95
+ | 2004-06-01 | day | 2004-06-(01)? | no | no | yes | no | no | no |
96
+ | 2004-06-01 | day | 2004-06-01~ | no | no | no | yes | yes | yes |
97
+ | 2004-06-01 | day | 2004-06~-01 | no | no | no | yes | yes | no |
98
+ | 2004-06-01 | day | 2004~-06-(01)~ | no | no | no | yes | no | yes |
99
+ | 2004-06-01 | day | 2004~-06-01 | no | no | no | yes | no | no |
100
+ | 2004-06-01 | day | 2004-(06-01)~ | no | no | no | no | yes | yes |
101
+ | 2004-06-01 | day | 2004-(06)~-01 | no | no | no | no | yes | no |
102
+ | 2004-06-01 | day | 2004-06-(01)~ | no | no | no | no | no | yes |
103
+ | 2004-06-01 | day | 2004-06-01 | no | no | no | no | no | no |
104
+
105
+ @wip
106
+ Scenarios: Uncertain or approximate dates, month precision
107
+ | date | precision | string | ?-year | ?-month | ?-day | ~-year | ~-month | ~-day |
108
+ | 2004-06-01 | month | 2004-06?~ | yes | yes | no | yes | yes | no |
109
+ | 2004-06-01 | month | 2004~-06? | yes | yes | no | yes | no | no |
110
+ # | 2004-06-01 | month | (2004-(06)~)? | yes | yes | no | no | yes | no |
111
+ | 2004-06-01 | month | 2004?-(06)?~ | yes | yes | no | no | yes | no |
112
+ | 2004-06-01 | month | 2004-06? | yes | yes | no | no | no | no |
113
+ | 2004-06-01 | month | 2004?-06~ | yes | no | no | yes | yes | no |
114
+ | 2004-06-01 | month | 2004?~-06 | yes | no | no | yes | no | no |
115
+ | 2004-06-01 | month | 2004?-(06)~ | yes | no | no | no | yes | no |
116
+ | 2004-06-01 | month | 2004?-06 | yes | no | no | no | no | no |
117
+ # | 2004-06-01 | month | (2004-(06)?)~ | no | yes | no | yes | yes | no |
118
+ | 2004-06-01 | month | 2004~-(06)?~ | no | yes | no | yes | yes | no |
119
+ | 2004-06-01 | month | 2004~-(06)? | no | yes | no | yes | no | no |
120
+ | 2004-06-01 | month | 2004-(06)?~ | no | yes | no | no | yes | no |
121
+ | 2004-06-01 | month | 2004-(06)? | no | yes | no | no | no | no |
122
+ | 2004-06-01 | month | 2004-06~ | no | no | no | yes | yes | no |
123
+ | 2004-06-01 | month | 2004~-06 | no | no | no | yes | no | no |
124
+ | 2004-06-01 | month | 2004-(06)~ | no | no | no | no | yes | no |
125
+ | 2004-06-01 | month | 2004-06 | no | no | no | no | no | no |
126
+
127
+
128
+ @wip
129
+ Scenarios: Uncertain or approximate dates, year precision
130
+ | date | precision | string | ?-year | ?-month | ?-day | ~-year | ~-month | ~-day |
131
+ | 2004-06-01 | year | 2004?~ | yes | no | no | yes | no | no |
132
+ | 2004-06-01 | year | 2004? | yes | no | no | no | no | no |
133
+ | 2004-06-01 | year | 2004~ | no | no | no | yes | no | no |
134
+ | 2004-06-01 | year | 2004 | no | no | no | no | no | no |