wiser_timezone 0.1.2 → 0.1.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmE5ZGEzMDYyNmJkMzAzNzBmMTE5MTM1YWI3NzAwNzM4YjJkNmMxMQ==
4
+ NDk0OTJlOWM5OGRkM2ViMDA1M2RkNmRjNjQxZGQyMTRkYTZkODFiOA==
5
5
  data.tar.gz: !binary |-
6
- NzQ3YmM2MmFkY2NiNzgzNWJjY2ExNDZlYjMyMDBiY2FjZWIxNWQwMA==
6
+ MDUzODJhMWNmMGE3YmY1ZmU5MjJkMWY5YzJhZTg0ODRhOGViMThkOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2JhZWMxZjQ5NzEyMjI4NWJjZTBiMzUzMTE4YzIxMzdhZDEzNjE0OWVjMDk0
10
- MjdhMDAwMzczZTEwYTFhZDMzMmE0OGI2MjBhZGJjZjhkODRjOTQ2MTA0NDFm
11
- MTJkODc0OTdlOGEyNjk5OWE2NjUxMzAzZjBhM2RhMDQ3NGIyOTI=
9
+ ZWJiNTVkN2ZjZWJmOTczYjlmMjJlN2YwOWY5OTFiZTA2NzY0ZTFiMzA0YWUz
10
+ YjQzYWQ1MWRmMmFjMzIxZDFjOTMxZjU4OTFkNDhjYTQzMzg4MmE0NDRhMTgw
11
+ NTI1YmVmNDE0NzFjMzc4OWQ5N2QwMjhmMDcyY2Q1NzM3MmRiZjc=
12
12
  data.tar.gz: !binary |-
13
- MmEwYjZhOWFkMjk0YjQ1ZDY1YzQ5ZDA1NDllMzkxNWE1ODkyNWI1YjFkYTMy
14
- NjU4ZmRmZWNmZGUwNmIxZTFlNTU5MjViZjUxZTM2M2E4MmE3NWU0ZjkzMDcx
15
- YjY2MmFjMzFjMjUwYTE0MDEyNDA0OWI2ZDg5ZGY1NTVjMjVjODE=
13
+ NDllNTk4MzczZGM1ZDEzOWQ1NDMwNGNkM2ZlOGMzMjUxMzliNjRhNmEzZWE1
14
+ M2U1MjE2YzQwMTBjMzE4ZTVkOTYyNWFkN2JjZDE1MGZhM2M5OTcyNzZhZGE0
15
+ NWIyZWU4Yzg5ODk4YjNmOGQxOGUwY2RiZmM4M2EzNTBhZTcyOGQ=
data/README.md CHANGED
@@ -16,7 +16,7 @@ You can do normal gem installation for `wiser_timezone` from your terminal:
16
16
 
17
17
  or add this line in your Gemfile:
18
18
 
19
- gem 'wiser_timezone', '~> 0.1.2'
19
+ gem 'wiser_timezone', '~> 0.1.3'
20
20
 
21
21
  Be sure to restart your application if it is already running.
22
22
 
@@ -95,6 +95,13 @@ Enable the *WiserTimezone* in the entire application by adding the `ensure_timez
95
95
  # More Codes
96
96
  end
97
97
 
98
+ ### Date Only
99
+
100
+ You can convert dates to timezone without having the time, in short, date only:
101
+
102
+ <%= wiser_timezone(@post.created_at, date_only: true) %>
103
+ // Return: 2014-03-15 00:00:00 +0800
104
+
98
105
 
99
106
  ### Extra
100
107
 
@@ -15,10 +15,14 @@ module WiserTimezone
15
15
  return "#{offset_str[0..3]}#{offset_str[4..-1].to_i}"
16
16
  end
17
17
 
18
- def wiser_timezone(date)
18
+ def wiser_timezone(date, date_only = false)
19
19
  begin
20
20
  date_time = date.to_datetime
21
- return date_time.in_time_zone(current_timezone)
21
+ if date_only
22
+ return date_time.in_time_zone(current_timezone).beginning_of_day
23
+ else
24
+ return date_time.in_time_zone(current_timezone)
25
+ end
22
26
  rescue
23
27
  raise "WiserTimezone can only accept date object."
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module WiserTimezone
2
- VERSION = "0.1.2"
3
- end
2
+ VERSION = "0.1.3"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiser_timezone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth John Balgos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler