ryanlowe-client_date 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/client_date.gemspec +5 -4
- data/public/javascripts/client_date.js +45 -0
- metadata +5 -12
data/client_date.gemspec
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "client_date"
|
3
|
-
s.version = "0.1.
|
4
|
-
s.date = "2008-
|
3
|
+
s.version = "0.1.1"
|
4
|
+
s.date = "2008-06-06"
|
5
5
|
s.summary = "Uses client-side Javascript to format a datetime instead of the Ruby on Rails server"
|
6
6
|
s.email = "rails@ryanlowe.ca"
|
7
7
|
s.homepage = "http://github.com/ryanlowe/client_date"
|
8
8
|
s.description = "Uses client-side Javascript to format a datetime instead of the Ruby on Rails server"
|
9
9
|
s.has_rdoc = false
|
10
10
|
s.authors = ["Ryan Lowe"]
|
11
|
-
s.files = ["README", "CHANGELOG", "MIT-LICENSE","Rakefile", "client_date.gemspec", "init.rb",
|
11
|
+
s.files = ["README", "CHANGELOG", "MIT-LICENSE","Rakefile", "client_date.gemspec", "init.rb",
|
12
|
+
"lib/client_date.rb",
|
13
|
+
"public/javascripts/client_date.js",
|
12
14
|
"test/client_date_test.rb","test/test_helper.rb"]
|
13
15
|
s.test_files = ["test/client_date_test.rb","test/test_helper.rb"]
|
14
16
|
s.rdoc_options = ["--main", "README"]
|
15
17
|
s.extra_rdoc_files = ["README","CHANGELOG"]
|
16
|
-
s.add_dependency("rails", ["> 2.0.0"])
|
17
18
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
var weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
3
|
+
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
4
|
+
|
5
|
+
function fdts(y,m,d,hr,mn,s) {
|
6
|
+
gmtDate = new Date(Date.UTC(y,m-1,d,hr,mn,s));
|
7
|
+
text = months[gmtDate.getMonth()];
|
8
|
+
text += ' '+gmtDate.getDate();
|
9
|
+
ampm = 'AM';
|
10
|
+
hours = gmtDate.getHours();
|
11
|
+
if (hours > 11) { ampm = 'PM'; }
|
12
|
+
if (hours == 0) { hours = 12; }
|
13
|
+
if (hours > 12) { hours -= 12; }
|
14
|
+
text += ' '+hours;
|
15
|
+
minutes = gmtDate.getMinutes();
|
16
|
+
if (minutes < 10) { minutes = '0'+minutes; }
|
17
|
+
text += ':'+minutes;
|
18
|
+
seconds = gmtDate.getSeconds();
|
19
|
+
if (seconds < 10) { seconds = '0'+seconds; }
|
20
|
+
text += ':'+seconds;
|
21
|
+
text += ' '+ampm;
|
22
|
+
document.write(text);
|
23
|
+
}
|
24
|
+
function fdt(y,m,d,hr,mn,s) {
|
25
|
+
gmtDate = new Date(Date.UTC(y,m-1,d,hr,mn,s));
|
26
|
+
text = months[gmtDate.getMonth()];
|
27
|
+
text += ' '+gmtDate.getDate();
|
28
|
+
ampm = 'AM';
|
29
|
+
hours = gmtDate.getHours();
|
30
|
+
if (hours > 11) { ampm = 'PM'; }
|
31
|
+
if (hours == 0) { hours = 12; }
|
32
|
+
if (hours > 12) { hours -= 12; }
|
33
|
+
text += ' '+hours;
|
34
|
+
minutes = gmtDate.getMinutes();
|
35
|
+
if (minutes < 10) { minutes = '0'+minutes; }
|
36
|
+
text += ':'+minutes;
|
37
|
+
text += ' '+ampm;
|
38
|
+
document.write(text);
|
39
|
+
}
|
40
|
+
function fd(y,m,d,hr,mn,s) {
|
41
|
+
gmtDate = new Date(Date.UTC(y,m-1,d,hr,mn,s));
|
42
|
+
text = months[gmtDate.getMonth()];
|
43
|
+
text += ' '+gmtDate.getDate();
|
44
|
+
document.write(text);
|
45
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ryanlowe-client_date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Lowe
|
@@ -9,18 +9,10 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-06-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: rails
|
17
|
-
version_requirement:
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - ">"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 2.0.0
|
23
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
24
16
|
description: Uses client-side Javascript to format a datetime instead of the Ruby on Rails server
|
25
17
|
email: rails@ryanlowe.ca
|
26
18
|
executables: []
|
@@ -38,6 +30,7 @@ files:
|
|
38
30
|
- client_date.gemspec
|
39
31
|
- init.rb
|
40
32
|
- lib/client_date.rb
|
33
|
+
- public/javascripts/client_date.js
|
41
34
|
- test/client_date_test.rb
|
42
35
|
- test/test_helper.rb
|
43
36
|
has_rdoc: false
|