Skip to content
This repository was archived by the owner on Apr 3, 2022. It is now read-only.

Commit 08f7686

Browse files
author
Ryan Arana
committed
Merge pull request #113 from esripdx/dev
[dev] >> [master] merge for final 1.0.3 release
2 parents b256fd9 + 3733ed7 commit 08f7686

File tree

5 files changed

+15
-40
lines changed

5 files changed

+15
-40
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ debug.out
1212
coverage/
1313
config.json
1414
npm-debug.log
15-
build/

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* zoom to extent of all requests when loading a bin
77
* catch invalid request URLs
88
* fix double-reporting pageview analytics bug (bump angulartics to 0.16.4)
9+
* use angular date filter to normalize dates across browsers
910

1011
# 1.0.2
1112
* refactor services

static/app/js/filters.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,33 @@
3333
};
3434
}])
3535

36-
// prettyDate
37-
// ----------
38-
// turns a unix timestamp into a localized date and time string
39-
40-
.filter('prettyTime', [function () {
41-
return function (ts) {
42-
return new Date(ts * 1000).toLocaleTimeString();
43-
};
36+
// makeDate
37+
// --------
38+
// turns a unix timestamp into a javascript Date object
39+
40+
.filter('makeDate', [function () {
41+
return function (ts) {
42+
return new Date(ts * 1000);
43+
};
4444
}])
4545

4646
// prettyDate
4747
// ----------
4848
// turns a unix timestamp into a localized date and time string
4949

50-
.filter('prettyDate', [function () {
50+
.filter('prettyTime', ['$filter', function ($filter) {
5151
return function (ts) {
52-
return new Date(ts * 1000).toLocaleDateString();
52+
return $filter('date')(new Date(ts * 1000), 'hh:mm:ss a');
5353
};
5454
}])
5555

56-
// prettyDateTime
57-
// --------------
56+
// prettyDate
57+
// ----------
5858
// turns a unix timestamp into a localized date and time string
5959

60-
.filter('prettyDateTime', [function () {
60+
.filter('prettyDate', ['$filter', function ($filter) {
6161
return function (ts) {
62-
return new Date(ts * 1000).toLocaleString();
62+
return $filter('date')(new Date(ts * 1000), 'MM/dd/yyyy');
6363
};
6464
}])
6565

static/app/partials/list.html

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</div>
1313
<div class="btn"
1414
data-toggle="tooltip" data-placement="bottom" title="date request was received">
15-
<i class="glyphicon glyphicon-calendar"></i>
1615
{{item.timestamp | prettyDate}}
1716
</div>
1817
</div>

test/unit/filtersSpec.js

-24
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,6 @@ describe('filters', function() {
3131
}));
3232
});
3333

34-
describe('prettyDate', function() {
35-
it('should turn a unix timestamp into a localized date string', inject(function(prettyDateFilter) {
36-
var d = new Date();
37-
var ts = Math.floor(d.getTime()/1000);
38-
expect(prettyDateFilter(ts)).toBe(d.toLocaleDateString());
39-
}));
40-
});
41-
42-
describe('prettyTime', function() {
43-
it('should turn a unix timestamp into a localized time string', inject(function(prettyTimeFilter) {
44-
var d = new Date();
45-
var ts = Math.floor(d.getTime()/1000);
46-
expect(prettyTimeFilter(ts)).toBe(d.toLocaleTimeString());
47-
}));
48-
});
49-
50-
describe('prettyDateTime', function() {
51-
it('should turn a unix timestamp into a localized time string', inject(function(prettyDateTimeFilter) {
52-
var d = new Date();
53-
var ts = Math.floor(d.getTime()/1000);
54-
expect(prettyDateTimeFilter(ts)).toBe(d.toLocaleString());
55-
}));
56-
});
57-
5834
describe('arrLength', function() {
5935
it('should return the proper length of a given array', inject(function(arrLengthFilter) {
6036
expect(arrLengthFilter([0,1,2])).toBe(3);

0 commit comments

Comments
 (0)