parsi-date 0.2.2 → 0.2.3
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.rdoc +10 -14
- data/lib/parsi-date.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/parsi-date/constants_spec.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
|
@@ -7,28 +7,24 @@ Conversion algorithm originally adopted from {here}[http://www.fourmilab.ch/docu
|
|
|
7
7
|
|
|
8
8
|
== Usage
|
|
9
9
|
|
|
10
|
-
You can use
|
|
10
|
+
You can use <tt>Parsi::Date<\tt> and <tt>Parsi::DateTime<\tt> objects as +Date+ and +DateTime+ objects
|
|
11
11
|
For example:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
b
|
|
16
|
-
a.upto(b).select{ |d| d.sunday? }.count # => 52
|
|
13
|
+
a = Parsi::Date.today # => #<Parsi::Date: 1391-08-09 (4912461/2,0/1)>
|
|
14
|
+
b = a >> 12 # => #<Parsi::Date: 1392-08-09 (4913193/2,0/1)>
|
|
15
|
+
a.upto(b).select{ |d| d.sunday? }.count # => 52
|
|
17
16
|
|
|
18
|
-
Parsi::Date.leap? 1391 # => true
|
|
17
|
+
Parsi::Date.leap? 1391 # => true
|
|
19
18
|
|
|
20
|
-
c = Parsi::Date.parse "1391/10/12" # => #<Parsi::Date: 1391-10-12 (4912587/2,0)>
|
|
21
|
-
c.strftime "%A %d %B %Y" # => "
|
|
22
|
-
c.strftime "%^EA %d %^EB %Y" # => "Seshambe 12 Day 1391"
|
|
23
|
-
```
|
|
19
|
+
c = Parsi::Date.parse "1391/10/12" # => #<Parsi::Date: 1391-10-12 (4912587/2,0)>
|
|
20
|
+
c.strftime "%A %d %B %Y" # => "سهشنبه 12 دی 1391"
|
|
21
|
+
c.strftime "%^EA %d %^EB %Y" # => "Seshambe 12 Day 1391"
|
|
24
22
|
|
|
25
23
|
For converting a +Date+ or +DateTime+ object just call +to_parsi+ (aliased to +jalali+ and +to_jalali+) on it.
|
|
26
24
|
To convert back use +to_gregorian+.
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
d
|
|
30
|
-
d.to_gregorian # => #<Date: 2012-10-30 ((2456231j,0s,0n),+0s,2299161j)>
|
|
31
|
-
```
|
|
26
|
+
d = Date.civil(2012, 10, 30).to_parsi # => #<Parsi::Date: 1391-08-09 (4912461/2,0/1)>
|
|
27
|
+
d.to_gregorian # => #<Date: 2012-10-30 ((2456231j,0s,0n),+0s,2299161j)>
|
|
32
28
|
|
|
33
29
|
|
|
34
30
|
|
data/lib/parsi-date.rb
CHANGED
|
@@ -99,7 +99,7 @@ module Parsi
|
|
|
99
99
|
# Full names of days of the week, in Farsi. Days of the week
|
|
100
100
|
# count from 0 to 6; a day's numerical representation indexed into this array gives
|
|
101
101
|
# the name of that day.
|
|
102
|
-
DAYNAMES = %w(یکشنبه دوشنبه سهشنبه چهارشنبه
|
|
102
|
+
DAYNAMES = %w(یکشنبه دوشنبه سهشنبه چهارشنبه پنجشنبه جمعه شنبه)
|
|
103
103
|
|
|
104
104
|
# Full names of days of the week, in English. Days of the week
|
|
105
105
|
# count from 0 to 6; a day's numerical representation indexed into this array gives
|
data/lib/version.rb
CHANGED
|
@@ -18,7 +18,7 @@ describe "Date constants" do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "defines DAYNAMES" do
|
|
21
|
-
Parsi::Date::DAYNAMES.should == %w(یکشنبه دوشنبه سهشنبه چهارشنبه
|
|
21
|
+
Parsi::Date::DAYNAMES.should == %w(یکشنبه دوشنبه سهشنبه چهارشنبه پنجشنبه جمعه شنبه)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it "defines EN_DAYNAMES" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: parsi-date
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|