wiser_date 0.1.9 → 0.2.6

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
- NzhhYTk3MmZmYThiYmFmNGZjNzliMWI3YjNlYzUzMzNkZmVhY2Y5Mw==
4
+ YTA2OTgwZTg2ZDU0OWU0OGI0ZjBhNzNkMGFmMmYzZjdkYWZmN2FjYw==
5
5
  data.tar.gz: !binary |-
6
- MDc0MDMzMGU4ZmFkN2Q1NGYyYTVhMjRjMmRiZDRiZDM0ZGIzZDVhYQ==
6
+ MDBlNGI2MzQ3ODg4YmYwMjczYjA1NDRkYTYxMmJlN2VmMjNmMzdhMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZTAyNDQ2OWU0ZjBkMWNmMTRjYjVjOTFiNDJlZGI1NjJlMTk3YzE4MGY1MzM3
10
- NjA5ZmVlMDMwYjBiNzgzZTNhMDU3M2JjZDkzODNjMDFhOGE3OGI4OGRlMWZm
11
- NzE1NzRhNWVmNGU4ZGQ4ZWE2Njg5MGNiNzhiNDM2MGUwNjAyNjA=
9
+ N2ZlZTgzZDY3Mjc0OGIxOTRmNjI4OWMzMTFlYzgyMmM1MDc0MWM2M2MzZWY1
10
+ ZmE5NTJlM2NiM2ZlMDY0MDExODE3Y2Y3ZTE0ZDY0NzkxMWY0NzAyMDBmMWI2
11
+ MmUwMWIyYTg5NjRiYzFjZmQyOTgwOGM1NzM2MDYwMjhiODk2MmY=
12
12
  data.tar.gz: !binary |-
13
- Y2FlZDM4OGYwNTc5YzRiMTdhMzQ4NmYxOWU3ZTgxZjE1MDljZTc4ODBkY2Nh
14
- NjZhZWNlOTA4MWU3N2I3MWJmMTc5NzYyZTE5ZmJhZTQxY2NmMDNiOWE0NjE0
15
- NjY0YmIyOTZjOWNhNDc2MGU2ODAyZTcyNjhmY2MxYTAzNWY5YWM=
13
+ MWY0YzIzMWExNTczMzVmN2M0MTYzZDVlMDhiNTMzZmQ4ZTkwNjQ5YjdiNTdl
14
+ NTI5NjM3OWIxNWZmYWI4MmZkMDM2MDQ2YjhkMDM3ODMxZDA2ODg0NzdkMDQz
15
+ YjM1YmY3ODhkOTlhNWRjODRjZTk4NTc1OThjNzUzN2JhODMwYTI=
data/README.rdoc CHANGED
@@ -1,11 +1,6 @@
1
1
  = Wiser Date for Rails
2
2
 
3
- WiserDate is a date formatting plugin written by Kenneth John Balgos (https://github.com/kennethjohnbalgos). Wiser Date features dynamic presentation of feed timestamps. Right now, it only displays the date statically. I'm writing the jQuery scripts to update the displayed dates in real-time and dynamic.
4
-
5
-
6
- == Installing Gem
7
-
8
- gem "wiser_date"
3
+ WiserDate is a date formatting plugin written by Kenneth John Balgos (https://github.com/kennethjohnbalgos). Wiser Date features dynamic presentation of feed timestamps. The plugin now supports real-time and dynamic date displays.
9
4
 
10
5
 
11
6
  == Dependency
@@ -13,7 +8,11 @@ WiserDate is a date formatting plugin written by Kenneth John Balgos (https://gi
13
8
  Rails >=3.1 and jQuery >=1.7 to make the real-time feature work.
14
9
 
15
10
 
16
- == Using the javascripts - Not Yet Available
11
+ == Installation
12
+
13
+ Install the gem.
14
+
15
+ gem "wiser_date"
17
16
 
18
17
  Require jquery.wiser_date in your app/assets/application.js file.
19
18
 
@@ -27,9 +26,10 @@ Use the wiser_date function in your views.
27
26
  <%= wiser_date @user.last_login_at %>
28
27
  # Sample display within few seconds: just now
29
28
  # Sample display within few minutes: about 30 minutes ago
30
- # Sample display within the day: about 15 hours ago
29
+ # Sample display within the day: about 3 hours ago
30
+ # Sample display later within the day: today at 12:21pm
31
31
  # Sample display after the day: yesterday 12:21pm
32
- # Sample display after 2 days: Sept 10, 2013 12:21pm
32
+ # Sample display after 2 days: September 10, 2013 12:21pm
33
33
 
34
34
  @user.last_login_at can be any timestamp you want to display.
35
35
 
@@ -40,12 +40,21 @@ Assume that the value is "Mon, 10 Sept 2012 12:21:16 UTC +00:00".
40
40
 
41
41
  You can customize the behavior of the date display by using the following options:
42
42
 
43
+ * *real_time* - toggles the real-time updating of displayed dates [default: true]
44
+
45
+ <%= wiser_date @user.last_login_at, :real_time => false %>
46
+
47
+ * *interval* - custom real-time update interval in seconds [default: 20]
48
+
49
+ <%= wiser_date @user.last_login_at, :interval => 60 %>
50
+
43
51
  * *date_format* - overrides the default date format [default: "%b %d, %Y"]
44
52
 
45
53
  <%= wiser_date @user.last_login_at, :date_format => "%Y-%m-%d" %>
46
54
  # Sample display within few seconds: just now
47
55
  # Sample display within few minutes: about 30 minutes ago
48
- # Sample display within the day: about 15 hours ago
56
+ # Sample display within the day: about 3 hours ago
57
+ # Sample display later within the day: today at 12:21pm
49
58
  # Sample display after the day: yesterday 12:21pm
50
59
  # Sample display after 2 days: 2012-09-10 12:21pm
51
60
 
@@ -54,58 +63,59 @@ You can customize the behavior of the date display by using the following option
54
63
  <%= wiser_date @user.last_login_at, :time_format => "%H:%M:%S" %>
55
64
  # Sample display within few seconds: just now
56
65
  # Sample display within few minutes: about 30 minutes ago
57
- # Sample display within the day: about 15 hours ago
66
+ # Sample display within the day: about 3 hours ago
67
+ # Sample display later within the day: today at 12:21:16
58
68
  # Sample display after the day: yesterday 12:21:16
59
- # Sample display after 2 days: Sept 10, 2013 12:21:16
69
+ # Sample display after 2 days: September 10, 2013 12:21:16
60
70
 
61
71
  * *humanize* - converts date to more readable string [default: true]
62
72
 
63
73
  <%= wiser_date @user.last_login_at, :humanize => false %>
64
- # Sample display within few seconds: Sept 10, 2013 12:21pm
65
- # Sample display within few minutes: Sept 10, 2013 12:21pm
66
- # Sample display within the day: Sept 10, 2013 12:21pm
67
- # Sample display after the day: Sept 10, 2013 12:21pm
68
- # Sample display after 2 days: Sept 10, 2013 12:21pm
74
+ # Sample display within few seconds: September 10, 2013 12:21pm
75
+ # Sample display within few minutes: September 10, 2013 12:21pm
76
+ # Sample display within the day: September 10, 2013 12:21pm
77
+ # Sample display later within the day: September 10, 2013 12:21pm
78
+ # Sample display after the day: September 10, 2013 12:21pm
79
+ # Sample display after 2 days: September 10, 2013 12:21pm
69
80
 
70
81
  * *time_first* - displays time first instead of date [default: false]
71
82
 
72
83
  <%= wiser_date @user.last_login_at, :time_first => true %>
73
84
  # Sample display within few seconds: just now
74
85
  # Sample display within few minutes: about 30 minutes ago
75
- # Sample display within the day: about 15 hours ago
86
+ # Sample display within the day: about 3 hours ago
87
+ # Sample display later within the day: 12:21pm today
76
88
  # Sample display after the day: 12:21pm yesterday
77
- # Sample display after 2 days: 12:21pm Sept 10, 2013
89
+ # Sample display after 2 days: 12:21pm September 10, 2013
78
90
 
79
91
  * *hide_same_year* - will not display the year if the it is the same with the present year [default: false]
80
92
 
81
93
  <%= wiser_date @user.last_login_at, :hide_same_year => true %>
82
94
  # Sample display within few seconds: just now
83
95
  # Sample display within few minutes: about 30 minutes ago
84
- # Sample display within the day: about 15 hours ago
96
+ # Sample display within the day: about 3 hours ago
97
+ # Sample display later within the day: today at 12:21pm
85
98
  # Sample display after the day: yesterday 12:21pm
86
- # Sample display after 2 days: Sept 10, 12:21pm
99
+ # Sample display after 2 days: September 10, 12:21pm
87
100
 
88
101
  * *capitalize* - capitalizes the first letter of the date displayed [default: true]
89
102
 
90
103
  <%= wiser_date @user.last_login_at, :capitalize => true %>
91
104
  # Sample display within few seconds: Just now
92
105
  # Sample display within few minutes: About 30 minutes ago
93
- # Sample display within the day: About 15 hours ago
106
+ # Sample display within the day: about 3 hours ago
107
+ # Sample display later within the day: Today at 12:21pm
94
108
  # Sample display after the day: Yesterday 12:21pm
95
- # Sample display after 2 days: Sept 10, 12:21pm
109
+ # Sample display after 2 days: September 10, 12:21pm
96
110
 
97
111
  * *custom_class* - adds custom classes to the containter span of the date [default: nil]
98
112
 
99
113
  <%= wiser_date @user.last_login_at, :custom_class => "date_tooltip" %>
100
114
 
101
- * *time_now* - accepts complete timestamp as the basis of time distances [default: nil]
115
+ * *time_now* - accepts complete timestamp as the basis of time distances [default: server_time]
102
116
 
103
117
  <%= wiser_date @user.last_login_at, :time_now => "2012-09-10 12:21:16 +0000" %>
104
118
 
105
119
 
106
- == Thanks
107
- Thanks to me for writing an awesome real-time date display plugin :p
108
-
109
-
110
120
  == Support
111
121
  Open an issue in https://github.com/kennethjohnbalgos/wiser_date if you need further support or want to report a bug.
@@ -1,25 +1,61 @@
1
1
  require 'date'
2
2
 
3
3
  module WiserDate
4
+
4
5
  module ViewHelpers
6
+
5
7
  include ActionView::Helpers::JavaScriptHelper
6
8
  include ActionView::Helpers::TagHelper
7
9
  include ActionView::Helpers::DateHelper
8
10
  include ActionView::Context
11
+
12
+ def wiser_date_global(options = {})
13
+ timezone = options.has_key?(:timezone) ? options[:timezone] : ""
14
+ interval = options.has_key?(:interval) ? options[:interval] : ""
15
+ time_now = options.has_key?(:time_now) ? options[:time_now] : ""
16
+ custom_class = options.has_key?(:custom_class) ? options[:custom_class] : ""
17
+
18
+ cookies[:wiser_date_timezone] = timezone
19
+ cookies[:wiser_date_interval] = interval
20
+ cookies[:wiser_date_time_now] = time_now
21
+ cookies[:wiser_date_custom_class] = custom_class
22
+ end
9
23
 
10
24
  def wiser_date(timestamp, options = {})
11
25
  # Options
12
26
  date_format = options.has_key?(:date_format) ? options[:date_format] : "%B %d, %Y"
13
27
  time_format = options.has_key?(:time_format) ? options[:time_format] : "%l:%M%P"
28
+ title = options.has_key?(:title) ? options[:title] : ""
14
29
  humanize = options.has_key?(:humanize) ? options[:humanize] : true
15
30
  time_first = options.has_key?(:time_first) ? options[:time_first] : false
16
31
  hide_same_year = options.has_key?(:hide_same_year) ? options[:hide_same_year] : false
32
+
17
33
  capitalize = options.has_key?(:capitalize) ? options[:capitalize] : true
18
- custom_class = options.has_key?(:custom_class) ? options[:custom_class] : nil
19
- time_now = options.has_key?(:time_now) ? options[:time_now].to_datetime : Time.now
20
34
  real_time = options.has_key?(:real_time) ? options[:real_time] : true
21
- interval = options.has_key?(:interval) ? options[:interval] : 20
35
+
36
+ if cookies[:wiser_date_custom_class].present? && !cookies[:wiser_date_custom_class].blank?
37
+ custom_class = cookies[:wiser_date_custom_class]
38
+ else
39
+ custom_class = options.has_key?(:custom_class) ? options[:custom_class] : nil
40
+ end
41
+
42
+ if cookies[:wiser_date_time_now].present? && !cookies[:wiser_date_time_now].blank?
43
+ time_now = cookies[:wiser_date_time_now]
44
+ else
45
+ time_now = options.has_key?(:time_now) ? options[:time_now].to_datetime : Time.now
46
+ end
47
+
48
+ if cookies[:wiser_date_interval].present? && !cookies[:wiser_date_interval].blank?
49
+ interval = cookies[:wiser_date_interval]
50
+ else
51
+ interval = options.has_key?(:interval) ? options[:interval] : 20
52
+ end
22
53
 
54
+ if cookies[:wiser_date_timezone].present? && !cookies[:wiser_date_timezone].blank?
55
+ time_now = time_now.to_datetime.in_time_zone(ActiveSupport::TimeZone[cookies[:wiser_date_timezone]])
56
+ timestamp = timestamp.to_datetime.in_time_zone(ActiveSupport::TimeZone[cookies[:wiser_date_timezone]])
57
+ end
58
+
23
59
  # Formats
24
60
  flat_format = "%Y%m%d%H%M%S"
25
61
  plain_format = "%Y-%m-%d %H:%M:%S"
@@ -29,6 +65,11 @@ module WiserDate
29
65
  custom_timestamp = timestamp.strftime(custom_format)
30
66
  plain_timestamp = timestamp.strftime(plain_format)
31
67
 
68
+ # Default Title
69
+ if title == ""
70
+ title = custom_timestamp
71
+ end
72
+
32
73
  # Humanize Display
33
74
  if humanize
34
75
  time_diff_in_seconds = (time_now - timestamp.to_time).ceil
@@ -36,32 +77,39 @@ module WiserDate
36
77
  time_diff_in_days = (time_diff_in_seconds / (60*60*24))
37
78
  if time_diff_in_seconds < 60 && time_diff_in_seconds >= 0
38
79
  custom_timestamp = "just now"
80
+ custom_timestamp = "today" if time_format == ""
39
81
  elsif time_now.to_date - 1.day == timestamp.to_date
40
82
  date_value = "yesterday"
41
83
  time_value = timestamp.strftime(time_format)
42
84
  custom_timestamp = time_first ? "#{time_value} #{date_value}" : "#{date_value} at #{time_value}"
85
+ custom_timestamp = date_value if time_format == ""
43
86
  elsif time_diff_in_days < 0
44
87
  if time_diff_in_days > -2
45
88
  date_value = "tomorrow"
46
89
  time_value = timestamp.strftime(time_format)
47
90
  custom_timestamp = time_first ? "#{time_value} #{date_value}" : "#{date_value} at #{time_value}"
91
+ custom_timestamp = date_value if time_format == ""
48
92
  elsif time_diff_in_days > -7
49
93
  date_value = "on " + timestamp.strftime('%A')
50
94
  time_value = timestamp.strftime(time_format)
51
95
  custom_timestamp = time_first ? "#{time_value} #{date_value}" : "#{date_value} at #{time_value}"
96
+ custom_timestamp = date_value if time_format == ""
52
97
  end
53
98
  elsif time_diff_in_days < 1
54
99
  if time_now.to_date == timestamp.to_date && time_diff_in_hours >= 8
55
100
  date_value = "today"
56
101
  time_value = timestamp.strftime(time_format)
57
102
  custom_timestamp = time_first ? "#{time_value} #{date_value}" : "#{date_value} at #{time_value}"
103
+ custom_timestamp = date_value if time_format == ""
58
104
  else
59
- custom_timestamp = "#{distance_of_time_in_words(Time.now, timestamp.to_time)} ago"
105
+ custom_timestamp = "#{distance_of_time_in_words(time_now, timestamp.to_time)} ago"
106
+ custom_timestamp = "today" if time_format == ""
60
107
  end
61
108
  elsif time_diff_in_days < 7
62
109
  date_value = "last " + timestamp.strftime('%A')
63
110
  time_value = timestamp.strftime(time_format)
64
111
  custom_timestamp = time_first ? "#{time_value} #{date_value}" : "#{date_value} at #{time_value}"
112
+ custom_timestamp = date_value if time_format == ""
65
113
  end
66
114
  end
67
115
 
@@ -81,26 +129,28 @@ module WiserDate
81
129
  classes << "humanize" if humanize
82
130
  classes << "capitalize" if capitalize
83
131
  classes << "real_time" if real_time
132
+ classes << "on" if real_time
133
+ classes << "-#{@timezone}-"
84
134
  classes = classes.join(' ')
85
-
135
+
86
136
  uniq_id = Digest::SHA1.hexdigest([Time.now, rand].join)
87
137
  html = content_tag(:span, custom_timestamp,
88
138
  "id" => uniq_id,
89
139
  "class" => classes,
90
140
  "data-plain-timestamp" => plain_timestamp,
91
141
  "data-date-format" => date_format,
92
- "data-time-format" => time_format
142
+ "data-time-format" => time_format,
143
+ "title" => title
93
144
  )
94
145
 
146
+ formatted_time_now = time_now.strftime(plain_format)
95
147
  meta_vars = []
96
- meta_vars << "data-value=\"#"+uniq_id+".real_time\""
97
- meta_vars << "data-custom-format=\""+custom_format+"\""
98
- meta_vars << "data-server-datetime=\""+time_now.strftime(plain_format)+"\""
99
- meta_vars << "data-server-datetime=\""+time_now.strftime(plain_format)+"\""
100
- meta_vars << "data-interval=\""+interval.to_s+"\""
148
+ meta_vars << "data-custom-format=\"" + custom_format + "\""
149
+ meta_vars << "data-server-datetime=\"" + formatted_time_now + "\""
150
+ meta_vars << "data-interval=\"" + interval.to_s + "\""
101
151
  meta_vars << "id=\"wiser_date\""
102
152
 
103
- html += javascript_tag("jQuery(document).ready(function(){if(jQuery('body meta#wiser_date').size() == 0){$('body').prepend('<meta "+meta_vars.join(' ')+" />')}else{$('meta#wiser_date').attr('data-value',$('meta#wiser_date').attr('data-value')+', #"+uniq_id+".real_time')}; updateWiserDate(\""+uniq_id+".real_time\");});")
153
+ html += javascript_tag("make_it_wiser_date('#" + uniq_id + "', '" + meta_vars.join(' ') + "');")
104
154
  html.html_safe
105
155
  end
106
156
  end
@@ -1,27 +1,23 @@
1
+ function make_it_wiser_date(id, meta_vars) {
2
+ jQuery(document).ready(function(){
3
+ if(jQuery('body meta#wiser_date').size() == 0){
4
+ jQuery('body').prepend("<meta " + meta_vars + " />")
5
+ };
6
+ updateWiserDate(id);
7
+ })
8
+ }
9
+
1
10
  function updateWiserDate(id) {
2
- if($('meta#wiser_date').attr('data-real-time-started') != "true"){
3
- update_interval = parseInt($('meta#wiser_date').attr('data-interval')) * 1000;
11
+ if(jQuery('meta#wiser_date').attr('data-real-time-started') != "true"){
12
+ update_interval = parseInt(jQuery('meta#wiser_date').attr('data-interval')) * 1000;
4
13
  setInterval(function() {
5
14
  update_timer(update_interval)
6
- span_ids = $('meta#wiser_date').attr('data-value').split(', ').filter(function(v){return v!==''});
7
- $.each(span_ids, function(i, val){
8
- if($(val).size() > 0){
9
- updateDate($(val));
10
- }else{
11
- excludeElement($(val));
12
- }
15
+ jQuery('.wiser_date.on').each(function(){
16
+ updateDate(jQuery(this));
13
17
  })
14
18
  },update_interval);
15
19
  }
16
- $('meta#wiser_date').attr('data-real-time-started','true');
17
- }
18
-
19
- function excludeElement(el){
20
- el_id = '#'+$(el).attr('id')+'.real_time'
21
- selector = $('meta#wiser_date').attr('data-value')
22
- selector = selector.replace(el_id, "")
23
- selector = selector.split(', ').filter(function(v){return v!==''}).join(', ')
24
- $('meta#wiser_date').attr('data-value',selector)
20
+ jQuery('meta#wiser_date').attr('data-real-time-started','true');
25
21
  }
26
22
 
27
23
  function updateDate(el){
@@ -38,7 +34,7 @@ function prettyDate(element){
38
34
  humanize = element.hasClass('humanize')
39
35
  time_first = element.hasClass('time_first')
40
36
 
41
- server_datetime = $('meta#wiser_date').attr('data-server-datetime')
37
+ server_datetime = jQuery('meta#wiser_date').attr('data-server-datetime')
42
38
  var time_now = new Date((server_datetime || "").replace(/-/g,"/").replace(/[TZ]/g," "));
43
39
  var timestamp = new Date((datetime || "").replace(/-/g,"/").replace(/[TZ]/g," "));
44
40
  var time_diff_in_seconds = ((time_now.getTime() - timestamp.getTime()) / 1000);
@@ -63,6 +59,9 @@ function prettyDate(element){
63
59
  }else if(humanize){
64
60
  if(time_diff_in_seconds < 60 && time_diff_in_seconds >= 0){
65
61
  custom_timestamp = "just now"
62
+ if(time_format == ""){
63
+ custom_timestamp = "today"
64
+ }
66
65
  }else if(custom_format(date_yesterday, plain_date_format) == custom_format(timestamp, plain_date_format)){
67
66
  date_value = "yesterday"
68
67
  time_value = custom_format(timestamp, time_format)
@@ -71,6 +70,9 @@ function prettyDate(element){
71
70
  }else{
72
71
  custom_timestamp = date_value + " at " + time_value;
73
72
  }
73
+ if(time_format == ""){
74
+ custom_timestamp = date_value
75
+ }
74
76
  }else if(time_diff_in_days < 0){
75
77
  if(time_diff_in_days > -2){
76
78
  date_value = "tomorrow"
@@ -79,6 +81,9 @@ function prettyDate(element){
79
81
  custom_timestamp = time_value + " " + date_value;
80
82
  }else{
81
83
  custom_timestamp = date_value + " at " + time_value;
84
+ }
85
+ if(time_format == ""){
86
+ custom_timestamp = date_value
82
87
  }
83
88
  }else if(time_diff_in_days > -7){
84
89
  date_value = "on " + custom_format(timestamp, "%A")
@@ -87,9 +92,12 @@ function prettyDate(element){
87
92
  custom_timestamp = time_value + " " + date_value;
88
93
  }else{
89
94
  custom_timestamp = date_value + " at " + time_value;
95
+ }
96
+ if(time_format == ""){
97
+ custom_timestamp = date_value
90
98
  }
91
99
  }else{
92
- excludeElement(element);
100
+ element.removeClass('on')
93
101
  custom_timestamp = regular_date_display
94
102
  }
95
103
  }else if(time_diff_in_days < 1){
@@ -100,9 +108,15 @@ function prettyDate(element){
100
108
  custom_timestamp = time_value + " " + date_value;
101
109
  }else{
102
110
  custom_timestamp = date_value + " at " + time_value;
111
+ }
112
+ if(time_format == ""){
113
+ custom_timestamp = date_value
103
114
  }
104
115
  }else{
105
116
  custom_timestamp = humanize_format(time_diff_in_seconds, time_diff_in_days);
117
+ if(time_format == ""){
118
+ custom_timestamp = "today"
119
+ }
106
120
  }
107
121
  }else if(time_diff_in_days < 7){
108
122
  date_value = "last " + custom_format(timestamp, "%A")
@@ -111,13 +125,16 @@ function prettyDate(element){
111
125
  custom_timestamp = time_value + " " + date_value;
112
126
  }else{
113
127
  custom_timestamp = date_value + " at " + time_value;
128
+ }
129
+ if(time_format == ""){
130
+ custom_timestamp = date_value
114
131
  }
115
132
  }else{
116
- excludeElement(element);
133
+ element.removeClass('on')
117
134
  custom_timestamp = regular_date_display
118
135
  }
119
136
  }else{
120
- excludeElement(element);
137
+ element.removeClass('on')
121
138
  custom_timestamp = regular_date_display
122
139
  }
123
140
 
@@ -133,12 +150,12 @@ function prettyDate(element){
133
150
 
134
151
  function update_timer(interval){
135
152
  if(!interval){interval = 1000;}
136
- current_datetime = $('meta#wiser_date').attr('data-server-datetime');
153
+ current_datetime = jQuery('meta#wiser_date').attr('data-server-datetime');
137
154
  current_datetime = new Date((current_datetime || "").replace(/-/g,"/").replace(/[TZ]/g," "));
138
155
  current_datetime.setTime(current_datetime.getTime() + interval);
139
156
  current_datetime = custom_format(current_datetime, "%Y-%m-%d %H:%M:%S");
140
- $('meta#wiser_date').attr('data-server-datetime', current_datetime);
141
- $('#real_time').text('The actual server time is ' + current_datetime);
157
+ jQuery('meta#wiser_date').attr('data-server-datetime', current_datetime);
158
+ jQuery('#real_time').text('The actual server time is ' + current_datetime);
142
159
  }
143
160
 
144
161
  function humanize_format(sec_diff, day_diff){
@@ -225,4 +242,4 @@ function DateFmt() {
225
242
 
226
243
  return dateTxt
227
244
  }
228
- }
245
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiser_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.6
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: 2012-05-28 00:00:00.000000000 Z
11
+ date: 2012-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails