date_format 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- data/lib/date_format/base.rb +8 -6
- metadata +2 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 860b7b694ad06379504cc3faec059f22ed2df1c2d9e29f4f7d999a570e4f1e5b
|
|
4
|
+
data.tar.gz: 9206c9d2c51eb1d2ce9107832ca5eb67f8ea024a6ace3360c95ea1159a1898f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f43f4b998289ec476a4ff4faa839e5e95c835e79018808e460ea95d3a40c83b5e6ae9f5dad9c6c703dc6bf0c081de343c116950360b9a2b8b50a62dc5183dec
|
|
7
|
+
data.tar.gz: b11600a711a2f07fd9de85bbecc8d390ff269543e24fc491133cf220bce5f22d7c56a6ac7f804fa2aac963b311aa6d1e6fc8e24ccdb621c51ca56e996e41d743
|
data/lib/date_format/base.rb
CHANGED
|
@@ -13,7 +13,7 @@ module DateFormat
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def self.choose_date_format(format_type)
|
|
16
|
-
case format_type
|
|
16
|
+
case format_type
|
|
17
17
|
when "ISO_8601_FORMAT" # => 2014-05-15
|
|
18
18
|
"%F"
|
|
19
19
|
when "GENERAL_DATE" # => 4/3/93 05:34:00 PM
|
|
@@ -62,6 +62,8 @@ module DateFormat
|
|
|
62
62
|
"%b"
|
|
63
63
|
when "ONLY_CURRENT_YEAR_MONTH" # => 201404 ***
|
|
64
64
|
"%Y%m"
|
|
65
|
+
when 'MYSQL_QUERY_FORMAT'
|
|
66
|
+
"%Y-%m-%d %H:%M:%S.%6N"
|
|
65
67
|
else
|
|
66
68
|
"%d.%m.%y"
|
|
67
69
|
end
|
|
@@ -89,11 +91,11 @@ module DateFormat
|
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
def self.choose_time_difference_format(time_difference_in_second, days, hours, minutes, seconds, format_type)
|
|
92
|
-
case format_type
|
|
93
|
-
|
|
94
|
+
case format_type
|
|
95
|
+
|
|
94
96
|
when "DAY_ONLY"
|
|
95
97
|
"#{days} Days"
|
|
96
|
-
|
|
98
|
+
|
|
97
99
|
when "HOUR_ONLY"
|
|
98
100
|
begin
|
|
99
101
|
only_hours = (time_difference_in_second/3600).round(2)
|
|
@@ -119,12 +121,12 @@ module DateFormat
|
|
|
119
121
|
|
|
120
122
|
|
|
121
123
|
def self.day_difference(start_date, end_date)
|
|
122
|
-
formatted_time = ""
|
|
124
|
+
formatted_time = ""
|
|
123
125
|
end_date = Time.now if end_date == 'PRESENT_DAY'
|
|
124
126
|
time_difference_in_second = (end_date - start_date).to_i
|
|
125
127
|
rest, seconds = time_difference_in_second.divmod( 60 )
|
|
126
128
|
rest, minutes = rest.divmod( 60 )
|
|
127
|
-
days, hours = rest.divmod( 24 )
|
|
129
|
+
days, hours = rest.divmod( 24 )
|
|
128
130
|
|
|
129
131
|
if days > 0
|
|
130
132
|
tag = (days < 2) ? "day" : "days"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: date_format
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rahul Patil
|
|
@@ -72,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: '0'
|
|
74
74
|
requirements: []
|
|
75
|
-
|
|
76
|
-
rubygems_version: 2.7.7
|
|
75
|
+
rubygems_version: 3.4.10
|
|
77
76
|
signing_key:
|
|
78
77
|
specification_version: 4
|
|
79
78
|
summary: Date Format
|