date_format 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/date_format/base.rb +15 -0
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b19f2a8c656abee0fe3491d554b4f983aa83362c
|
4
|
+
data.tar.gz: ad09ba382c732087fe110a0e7c099f6d219f1164
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f73ad8bf16089e70ff7680dc5478953bde494ea842cf786a88cfd7744b5cf68e4b0a14e87b553b2382846216ae7b96504cb1d84b610490609d348445a6e3907
|
7
|
+
data.tar.gz: 73db34d7f3454f1202c0e81e8941dd86c56c94498649b434f217a9f2eb33827ae00e1df6cb748744c8fb72cd77f4e78a5ba0412930ed8e97dcb954d92a0ab1b8
|
data/README.md
CHANGED
@@ -41,6 +41,22 @@ Try this snippet of code on ruby irb
|
|
41
41
|
puts DateFormat.change_to(today_time, "")
|
42
42
|
puts DateFormat.change_to("", "")
|
43
43
|
|
44
|
+
# For Time Difference
|
45
|
+
start_date = Time.parse('2014-05-25 18:37:11')
|
46
|
+
DateFormat.time_difference(start_date, "PRESENT_DAY", "DAY_ONLY")
|
47
|
+
DateFormat.time_difference(start_date, "PRESENT_DAY", "HOUR_ONLY")
|
48
|
+
DateFormat.time_difference(start_date, "PRESENT_DAY", "MINUTE_ONLY")
|
49
|
+
DateFormat.time_difference(start_date, "PRESENT_DAY", "SECOND_ONLY")
|
50
|
+
DateFormat.time_difference(start_date, "", "DAY_ONLY")
|
51
|
+
DateFormat.time_difference(start_date, "", "HOUR_ONLY")
|
52
|
+
DateFormat.time_difference(start_date, "", "MINUTE_ONLY")
|
53
|
+
DateFormat.time_difference(start_date, "", "SECOND_ONLY")
|
54
|
+
DateFormat.time_difference(start_date, "AA", "HOUR_ONLY")
|
55
|
+
DateFormat.time_difference(start_date, "XX", "MINUTE_ONLY")
|
56
|
+
DateFormat.time_difference(start_date, "DD", "SECOND_ONLY")
|
57
|
+
|
58
|
+
|
59
|
+
|
44
60
|
## Contributing
|
45
61
|
|
46
62
|
1. Fork it ( https://github.com/[my-github-username]/date_format/fork )
|
data/lib/date_format/base.rb
CHANGED
@@ -42,6 +42,21 @@ module DateFormat
|
|
42
42
|
"%H:%M"
|
43
43
|
when "MINUTE_IN_HOUR" # => 34 Minute
|
44
44
|
"%M"
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
when "LONG_DATE_SHORT" # => Sat, April 3, 2014***
|
49
|
+
"%a, %B %d, %Y"
|
50
|
+
when "ONLY_DATE" # => April 3, 2014***
|
51
|
+
"%B %d, %Y"
|
52
|
+
when "ONLY_DATE_SHORT" # => Apr 3, 2014***
|
53
|
+
"%b %d, %Y"
|
54
|
+
when "ONLY_DATE_DEFAULT" # => 3/4/2014 ***
|
55
|
+
"%d/%m/%Y"
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
45
60
|
else
|
46
61
|
"%d.%m.%y"
|
47
62
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: date_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rahul Patil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: The library take raw date as input and adds a method to give formatted
|
@@ -63,12 +63,12 @@ require_paths:
|
|
63
63
|
- lib
|
64
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
@@ -78,4 +78,3 @@ signing_key:
|
|
78
78
|
specification_version: 4
|
79
79
|
summary: Date Format
|
80
80
|
test_files: []
|
81
|
-
has_rdoc:
|