dater 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +11 -7
- data/lib/dater/version.rb +1 -1
- data/lib/dater.rb +6 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -7,9 +7,9 @@ You can also, convert dates from 'dd/mm/yyyy' to 'yyyy-mm-dd' or viceversa.
|
|
7
7
|
|
8
8
|
If you want to pass a formatted date like dd/mm/yyyy to convert to yyyy-mm-dd, you have to take care about only two things with the argument:
|
9
9
|
|
10
|
-
|
10
|
+
1. Year number must have four digits.
|
11
11
|
|
12
|
-
|
12
|
+
2. Month number must be always in the middle.
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
@@ -27,12 +27,16 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
-
|
30
|
+
#Require gem
|
31
|
+
|
32
|
+
require 'dater'
|
33
|
+
|
34
|
+
#Initialize a dater object with a format to convert to:
|
31
35
|
|
32
36
|
date=Dater::Resolver.new('%Y-%m-%d')
|
33
37
|
|
34
|
-
To get the converted date:
|
35
|
-
|
38
|
+
#To get the converted date:
|
39
|
+
|
36
40
|
date.for("in 2 days") # => yyyy-mm-dd (date for 2 days from the date of today)
|
37
41
|
date.for("in 10 months") # => yyyy-mm-dd (date for 10 months from the date of today)
|
38
42
|
date.for("in 1 year") # => yyyy-mm-dd (date for 1 year from the date of today)
|
@@ -55,7 +59,7 @@ It does not work correctly with leap-years and calculates months of 30 days only
|
|
55
59
|
|
56
60
|
Si deseas usar esta gema en español puedes inicializar la clase de la siguiente manera:
|
57
61
|
|
58
|
-
date=Dater::Resolver.new('%Y-%m-%d', "
|
62
|
+
date=Dater::Resolver.new('%Y-%m-%d', "es")
|
59
63
|
|
60
64
|
Con eso puedes pasar argumentos en idioma español (por ejemplo 'en 2 días', 'en 10 meses', 'en 1 año')
|
61
65
|
|
@@ -65,7 +69,7 @@ Se você quiser usar esta gem em Português, você pode inicializar a classe da
|
|
65
69
|
|
66
70
|
date=Dater::Resolver.new('%Y-%m-%d', "pt")
|
67
71
|
|
68
|
-
Com isso você pode passar argumentos em Português (em
|
72
|
+
Com isso você pode passar argumentos em Português (em 2 dias, em 10 meses, 1 ano)
|
69
73
|
## Contributing
|
70
74
|
|
71
75
|
1. Fork it
|
data/lib/dater/version.rb
CHANGED
data/lib/dater.rb
CHANGED