fuzzy-date 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/demo.rb +1 -1
- data/lib/fuzzy-date.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4b775858eb61b4d03ab7006f13a279d3be9732f
|
4
|
+
data.tar.gz: a4bfd9ea64ccbd930729e1bce1fac563a485bc85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4802c6c67c784947388194aca1575a873a0d27693c27a63b325da20b0e975be7e0bb110508e73a51a5f1efaedb8f31d1f0ae8815290322a6df04b66ddd770a2
|
7
|
+
data.tar.gz: b809b0de412a01fd2d191e68083c004b1838d972a379e8e4dac6cdca785f367a8dac7ec3066ba175954626f4cf938d6777480935f374a1eb0bf41c714e5fa75f
|
data/demo.rb
CHANGED
data/lib/fuzzy-date.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
3
|
module FuzzyDate
|
4
|
-
VERSION = '0.1.
|
4
|
+
VERSION = '0.1.2'
|
5
5
|
|
6
6
|
DATE_SEPARATOR = '[^A-Za-z0-9]'
|
7
7
|
|
@@ -85,7 +85,7 @@ module FuzzyDate
|
|
85
85
|
# * YYYY-MM - 3 or 4 digit year, then 1 or 2 digit month
|
86
86
|
# * YYYY - 3 or 4 digit year
|
87
87
|
# * MM-DD-YYYY - 1 or 2 digit month, then 1 or 2 digit day, then 1 to 4 digit year
|
88
|
-
# * DD-MM-YYYY - 1 or 2 digit day, then 1 or 2 digit month, then 1 to 4 digit year if
|
88
|
+
# * DD-MM-YYYY - 1 or 2 digit day, then 1 or 2 digit month, then 1 to 4 digit year if euro is true
|
89
89
|
# * MM-YYYY - 1 or 2 digit month, then 1 to 4 digit year
|
90
90
|
# * DD-MMM - 1 or 2 digit day, then month name or abbreviation
|
91
91
|
# * DD-MMM-YYYY - 1 or 2 digit day, then month name or abbreviation, then 1 to 4 digit year
|
@@ -98,7 +98,7 @@ module FuzzyDate
|
|
98
98
|
# - All dates may be suffixed with the era (AD, BC, CE, BCE). AD is assumed.
|
99
99
|
# - Dates may be prefixed by circa words (Circa, About, Abt).
|
100
100
|
|
101
|
-
def self.parse( date,
|
101
|
+
def self.parse( date, euro = false )
|
102
102
|
|
103
103
|
date = clean_parameter date
|
104
104
|
|
@@ -138,7 +138,7 @@ module FuzzyDate
|
|
138
138
|
day = $3 ? $3.to_i.to_s : nil
|
139
139
|
|
140
140
|
#- Takes care of DD-MM-YYYY
|
141
|
-
elsif date =~ /^(\d{1,2})-(\d{1,2})-(\d{1,4})$/ and
|
141
|
+
elsif date =~ /^(\d{1,2})-(\d{1,2})-(\d{1,4})$/ and euro
|
142
142
|
day = $1.to_i.to_s
|
143
143
|
month = $2.to_i.to_s
|
144
144
|
year = $3.to_i.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuzzy-date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cole
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The fuzzy-date gem provides a way to parse and use incomplete dates,
|
14
14
|
like those found in history or genealogy.
|