local_time 1.0.0 → 1.0.1

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: 0d42dfef630d09374cd897d5a842566191ff07cd
4
- data.tar.gz: 671f048d37ba09ade8df1e01dd8c4bb36f5ccfab
3
+ metadata.gz: 9acb2cdc9393fe73fbf0b341bbc360187555a519
4
+ data.tar.gz: 01f0b7122ec7242de2354153318c2cf118e34573
5
5
  SHA512:
6
- metadata.gz: 6209af737d470ff029db6233ca5f30e6840e8e74c40db30aca1a8ad9a592dbd705ea2159ff16eb37118946dee8d6f6db1fbfd69d6f129d30b9aab1c3f3a93b18
7
- data.tar.gz: 26786c11ec81af062927263f55e5f4103532dbdc871d535e0e272a5c95b8a94f6e8979d165154330c3bc2cc0b93ac202f4202546f04258012e75b82d4c1d8ce1
6
+ metadata.gz: 20a08a3c22c744cc148b198a9e7129f57e129a28fd79ff80b270e30db834b8a6dba2aeaf7ac28a6314a3936fac3c18601f7a451409e12e6f805d0c985073a92d
7
+ data.tar.gz: 6b3da2da805d8661c07a3462a40eb706d529c9a7a2b69365d6e92af0773f6a9927db2d7a6f855220d6fb8986936dcd4df4f641e35775f06587401ea32cd20a84
data/README.md CHANGED
@@ -96,8 +96,9 @@ Preset time and date formats that vary with age. The available types are `date`,
96
96
 
97
97
  * `date` Inlcudes the year unless it's current. "Apr 11" or "Apr 11, 2013"
98
98
  * `time-ago` See above. `local_time_ago` calls `local_relative_time` with this `:type` option.
99
- * `time-or-date` Displays the time if it's todday. Displays time otherwise. "3:26pm" or "Apr 11"
99
+ * `time-or-date` Displays the time if it occurs today or the date if not. "3:26pm" or "Apr 11"
100
100
  * `weekday` Displays "Today", "Yesterday", or the weekday (e.g. Wednesday) if the time is within a week of today.
101
+ * `weekday-or-date` Displays the weekday if it occurs within a week or the date if not. "Yesterday" or "Apr 11"
101
102
 
102
103
  #### Installation
103
104
 
@@ -126,6 +127,10 @@ The included JavaScript does not depend on any frameworks or libraries, and list
126
127
 
127
128
  #### Version History
128
129
 
130
+ **1.0.1** (December 3, 2014)
131
+
132
+ * Added `weekday-or-date` option [Chew Choon Keat]
133
+
129
134
  **1.0.0** (April 12, 2014)
130
135
 
131
136
  * Added `local_relative_time` helper with several built in types
@@ -221,6 +221,8 @@ document.addEventListener "DOMContentLoaded", ->
221
221
  relativeTimeOrDate time
222
222
  when "weekday"
223
223
  relativeWeekday(time) ? ""
224
+ when "weekday-or-date"
225
+ relativeWeekday(time) ? relativeDate(time)
224
226
 
225
227
  run = ->
226
228
  event = document.createEvent "Events"
@@ -63,3 +63,34 @@ test "before this week", ->
63
63
  run()
64
64
 
65
65
  equal getText(el), ""
66
+
67
+ module "relative weekday or date"
68
+
69
+
70
+ test "today", ->
71
+ now = moment()
72
+ el = addTimeEl type: "weekday-or-date", datetime: now.toISOString()
73
+ run()
74
+
75
+ equal getText(el), "Today"
76
+
77
+ test "yesterday", ->
78
+ yesterday = moment().subtract("days", 1)
79
+ el = addTimeEl type: "weekday-or-date", datetime: yesterday.toISOString()
80
+ run()
81
+
82
+ equal getText(el), "Yesterday"
83
+
84
+ test "this week", ->
85
+ recent = moment().subtract("days", 3)
86
+ el = addTimeEl type: "weekday-or-date", datetime: recent.toISOString()
87
+ run()
88
+
89
+ equal getText(el), recent.format("dddd")
90
+
91
+ test "before this week", ->
92
+ before = moment().subtract("days", 8)
93
+ el = addTimeEl type: "weekday-or-date", datetime: before.toISOString()
94
+ run()
95
+
96
+ equal getText(el), before.format("MMM D")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: local_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali
@@ -9,34 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-12 00:00:00.000000000 Z
12
+ date: 2014-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coffee-rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rails
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  description:
@@ -45,11 +45,11 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - MIT-LICENSE
49
+ - README.md
48
50
  - app/assets/javascripts/local_time.js.coffee
49
51
  - app/helpers/local_time_helper.rb
50
52
  - lib/local_time.rb
51
- - MIT-LICENSE
52
- - README.md
53
53
  - test/helpers/local_time_helper_test.rb
54
54
  - test/javascripts/local_time/index.js.coffee
55
55
  - test/javascripts/local_time/local_time_test.js.coffee
@@ -75,17 +75,17 @@ require_paths:
75
75
  - lib
76
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
87
  rubyforge_project:
88
- rubygems_version: 2.1.11
88
+ rubygems_version: 2.2.2
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Rails engine for cache-friendly, client-side local time