i18n-js 3.2.1 → 3.2.2

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
  SHA256:
3
- metadata.gz: ceb49e2e527b6abd26c72eb57d2489197ed2d3991b24bc79acef35869a171232
4
- data.tar.gz: 40f6a0b8c6c9d312db6a859123f22f7a8a46e7ef92f495b7ea024d6885e88b85
3
+ metadata.gz: cf57fa8dfcf89f2bbe736899750fc67fbc54c461cf199f5224f13136fadaf49d
4
+ data.tar.gz: 9ac09fae9997e09d056d269b639282415b637c1a27aaba63138b3f03af12e917
5
5
  SHA512:
6
- metadata.gz: 030147ab7bb566fcadadb31090480fbcf233850ec9ea0468e8b4d7d984d8a5a77c7e9a7366e8babb40139313c2306774d10e8812869c0a6c083d66b9a4312224
7
- data.tar.gz: 388552233bb2a66c6c899d28daca4a9ca49aa115b19cc765ba2cbe00308f9c4b3840fb92c0ca4fc71a78e5a2bed5a780e8cc7431348a7d53f5b11dc806d741ed
6
+ metadata.gz: fa3def42f8e86c9da13edf1faab48070cfa2b58d74f620815efb24f98af448a78f85512bf83d7c79b04d4e30c7f83d978fc1986af24fba757f5a1d79541849d9
7
+ data.tar.gz: 833f82ecfa20b6bc152dc3aa41f00dec9a6ac3820788c103ddc2cd3b37bddd76609af851e84e8a05d4e9afd83ff93fc9c8a718699c326856bac9491a5b0f9183
@@ -27,6 +27,7 @@ gemfile:
27
27
  - gemfiles/i18n_1_3.gemfile
28
28
  - gemfiles/i18n_1_4.gemfile
29
29
  - gemfiles/i18n_1_5.gemfile
30
+ - gemfiles/i18n_1_6.gemfile
30
31
  matrix:
31
32
  fast_finish: true
32
33
  allow_failures:
data/Appraisals CHANGED
@@ -30,3 +30,7 @@ end
30
30
  appraise "i18n_1_5" do
31
31
  gem "i18n", "~> 1.5.1"
32
32
  end
33
+
34
+ appraise "i18n_1_6" do
35
+ gem "i18n", "~> 1.6.0"
36
+ end
@@ -18,6 +18,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [3.2.2] - 2019-05-09
22
+
23
+ ### Fixed
24
+
25
+ - [JS] Return invalid date/time input values (null & undefined) as-is
26
+ (Commit: https://github.com/fnando/i18n-js/commit/869d1689ed788ff50121de492db354652971c23d)
27
+
28
+
21
29
  ## [3.2.1] - 2019-01-22
22
30
 
23
31
  ### Changed
@@ -377,7 +385,8 @@ And today is not April Fools' Day
377
385
 
378
386
 
379
387
 
380
- [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.2.1...HEAD
388
+ [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.2.2...HEAD
389
+ [3.2.2]: https://github.com/fnando/i18n-js/compare/v3.2.1...v3.2.2
381
390
  [3.2.1]: https://github.com/fnando/i18n-js/compare/v3.2.0...v3.2.1
382
391
  [3.2.0]: https://github.com/fnando/i18n-js/compare/v3.1.0...v3.2.0
383
392
  [3.1.0]: https://github.com/fnando/i18n-js/compare/v3.0.11...v3.1.0
@@ -615,7 +615,7 @@
615
615
 
616
616
  // This function interpolates the all variables in the given message.
617
617
  I18n.interpolate = function(message, options) {
618
- if (message === null) {
618
+ if (message == null) {
619
619
  return message;
620
620
  }
621
621
 
@@ -833,8 +833,12 @@
833
833
  //
834
834
  I18n.parseDate = function(date) {
835
835
  var matches, convertedDate, fraction;
836
+ // A date input of `null` or `undefined` will be returned as-is
837
+ if (date == null) {
838
+ return date;
839
+ }
836
840
  // we have a date, so just return it.
837
- if (typeof(date) == "object") {
841
+ if (typeof(date) === "object") {
838
842
  return date;
839
843
  }
840
844
 
@@ -980,12 +984,18 @@
980
984
  , format = this.lookup(scope)
981
985
  ;
982
986
 
983
- if (date.toString().match(/invalid/i)) {
984
- return date.toString();
987
+ // A date input of `null` or `undefined` will be returned as-is
988
+ if (date == null) {
989
+ return date;
990
+ }
991
+
992
+ var date_string = date.toString()
993
+ if (date_string.match(/invalid/i)) {
994
+ return date_string;
985
995
  }
986
996
 
987
997
  if (!format) {
988
- return date.toString();
998
+ return date_string;
989
999
  }
990
1000
 
991
1001
  return this.strftime(date, format);
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "i18n", "~> 1.6.0"
6
+
7
+ gemspec path: "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module I18n
4
4
  module JS
5
- VERSION = "3.2.1"
5
+ VERSION = "3.2.2"
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18n-js",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "description": "A javascript library similar to Ruby on Rails i18n gem",
5
5
  "author": "Nando Vieira",
6
6
  "license": "MIT",
@@ -34,6 +34,12 @@ describe("Localization", function(){
34
34
  expect(I18n.l("time.formats.long", "2009-11-29 15:07:59")).toEqual("Domingo, 29 de Novembro de 2009, 15:07 h");
35
35
  });
36
36
 
37
+ it("return 'Invalid Date' or original value for invalid input", function(){
38
+ expect(I18n.l("time.formats.default", "")).toEqual("Invalid Date");
39
+ expect(I18n.l("time.formats.default", null)).toEqual(null);
40
+ expect(I18n.l("time.formats.default", undefined)).toEqual(undefined);
41
+ });
42
+
37
43
  it("localizes date/time strings with placeholders", function(){
38
44
  I18n.locale = "pt-BR";
39
45
 
@@ -45,4 +51,4 @@ describe("Localization", function(){
45
51
  I18n.locale = "pt-BR";
46
52
  expect(I18n.l("percentage", 123.45)).toEqual("123,45%");
47
53
  });
48
- });
54
+ });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -124,6 +124,7 @@ files:
124
124
  - gemfiles/i18n_1_3.gemfile
125
125
  - gemfiles/i18n_1_4.gemfile
126
126
  - gemfiles/i18n_1_5.gemfile
127
+ - gemfiles/i18n_1_6.gemfile
127
128
  - i18n-js.gemspec
128
129
  - lib/i18n-js.rb
129
130
  - lib/i18n/js.rb
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  - !ruby/object:Gem::Version
218
219
  version: '0'
219
220
  requirements: []
220
- rubygems_version: 3.0.2
221
+ rubygems_version: 3.0.3
221
222
  signing_key:
222
223
  specification_version: 4
223
224
  summary: It's a small library to provide the Rails I18n translations on the Javascript.