browser-timezone-rails 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22750aa5b1b9e419de58c2a8a6c29239b77bd74d
4
- data.tar.gz: 7b86002f2eb920bf3955d65816a32c9ee31844df
3
+ metadata.gz: 36c61f0b3e6e456a8a3eefac77a68240d0ee7539
4
+ data.tar.gz: 69cff59ce807a41d32ccfb647b97282f63ff6ac0
5
5
  SHA512:
6
- metadata.gz: e9ddf9be32db4385bf88ec53a4ed4147da7fe75903068e07f145180d588dbcac49cb5adc1d1a7449bea78c087a0e42981011cd077d32f019528a5dcb8e3f0265
7
- data.tar.gz: e95b30c11c0f191b5848ed8333fdd0a0b4a88ecc64333d78bf734465be220e166efe224ac836d744d0c268e75a65330c624d5094510c7be9a2ba55d591ce9a72
6
+ metadata.gz: eec1e70450da61a3273f07f0cba82fb12578eaaf219101725cb14f6ec90d3f2f36c2e4e5e47aa4c4bb44d1fa8c94a0247bf1952b27305829be1595b70a887745
7
+ data.tar.gz: 0f1ac70a00b969cdde3964d05799f60474f2f99f5b193ede00241e0fc048250c1bfe69d75b68aea5b2d3c70f4bbe373cfdd00db4c73d65bd7cae1e7517c7a2da
data/README.md CHANGED
@@ -16,14 +16,19 @@ gem 'browser-timezone-rails'
16
16
  Make sure you have each of the following entries in your application.js:
17
17
  ```
18
18
  //= require js.cookie
19
- //= require jstz
20
19
  //= require browser_timezone_rails/set_time_zone
21
20
  ```
22
21
  That's it! No other configuration is needed as it's all done for you with this gem including setting up your application controller to start using your users' zones.
23
22
 
24
23
  ## How it works
25
24
 
26
- The browsers timezone is set in a cookie using the awesome [jsTimezoneDetect](https://bitbucket.org/pellepim/jstimezonedetect) javascript library. That cookie is then read during each request to set the Rails timezone for that user.
25
+ The browser's timezone is set in a cookie using the modern [ECMAScript Internationalization API](https://www.ecma-international.org/ecma-402/)
26
+
27
+ Caveat: doesn't work with Internet Explorer.
28
+
29
+ (Up to 1.0.4 version of the gem, the cookie was set via the [jsTimezoneDetect](https://bitbucket.org/pellepim/jstimezonedetect) javascript library, which, however, was often inaccurate.)
30
+
31
+ That cookie is then read during each request to set the Rails timezone for that user.
27
32
 
28
33
  You can also read more about this implementation here: [Blog](http://cowjumpedoverthecommodore64.blogspot.in/2013/03/setting-rails-timezone-to-users.html)
29
34
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Cookies.set(
4
4
  "browser.timezone",
5
- jstz.determine().name(),
5
+ Intl.DateTimeFormat().resolvedOptions().timeZone,
6
6
  {
7
7
  expires: 365,
8
8
  path: '/',
@@ -10,4 +10,3 @@
10
10
  }
11
11
  );
12
12
  })();
13
-
@@ -2,10 +2,9 @@
2
2
 
3
3
  require 'browser-timezone-rails/engine'
4
4
  require 'js_cookie_rails'
5
- require 'jstz-rails'
6
5
 
7
6
  module BrowserTimezoneRails
8
- PREPEND_METHOD = if Rails::VERSION::MAJOR == 3 || (Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2)
7
+ PREPEND_METHOD = if Rails::VERSION::MAJOR == 3 || (Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR < 2)
9
8
  :prepend_around_filter
10
9
  else
11
10
  :prepend_around_action
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module BrowserTimezoneRails
2
- VERSION = "1.0.4"
4
+ VERSION = '1.1.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser-timezone-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kbaum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-30 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: jstz-rails3-plus
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec-rails
57
43
  requirement: !ruby/object:Gem::Requirement