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

Commit

Permalink
Merge pull request #113 from esripdx/dev
Browse files Browse the repository at this point in the history
[dev] >> [master] merge for final 1.0.3 release
  • Loading branch information
Ryan Arana committed Nov 17, 2014
2 parents b256fd9 + 3733ed7 commit 08f7686
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 40 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ debug.out
coverage/
config.json
npm-debug.log
build/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* zoom to extent of all requests when loading a bin
* catch invalid request URLs
* fix double-reporting pageview analytics bug (bump angulartics to 0.16.4)
* use angular date filter to normalize dates across browsers

# 1.0.2
* refactor services
Expand Down
28 changes: 14 additions & 14 deletions static/app/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,33 @@
};
}])

// prettyDate
// ----------
// turns a unix timestamp into a localized date and time string

.filter('prettyTime', [function () {
return function (ts) {
return new Date(ts * 1000).toLocaleTimeString();
};
// makeDate
// --------
// turns a unix timestamp into a javascript Date object

.filter('makeDate', [function () {
return function (ts) {
return new Date(ts * 1000);
};
}])

// prettyDate
// ----------
// turns a unix timestamp into a localized date and time string

.filter('prettyDate', [function () {
.filter('prettyTime', ['$filter', function ($filter) {
return function (ts) {
return new Date(ts * 1000).toLocaleDateString();
return $filter('date')(new Date(ts * 1000), 'hh:mm:ss a');
};
}])

// prettyDateTime
// --------------
// prettyDate
// ----------
// turns a unix timestamp into a localized date and time string

.filter('prettyDateTime', [function () {
.filter('prettyDate', ['$filter', function ($filter) {
return function (ts) {
return new Date(ts * 1000).toLocaleString();
return $filter('date')(new Date(ts * 1000), 'MM/dd/yyyy');
};
}])

Expand Down
1 change: 0 additions & 1 deletion static/app/partials/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
</div>
<div class="btn"
data-toggle="tooltip" data-placement="bottom" title="date request was received">
<i class="glyphicon glyphicon-calendar"></i>
{{item.timestamp | prettyDate}}
</div>
</div>
Expand Down
24 changes: 0 additions & 24 deletions test/unit/filtersSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,6 @@ describe('filters', function() {
}));
});

describe('prettyDate', function() {
it('should turn a unix timestamp into a localized date string', inject(function(prettyDateFilter) {
var d = new Date();
var ts = Math.floor(d.getTime()/1000);
expect(prettyDateFilter(ts)).toBe(d.toLocaleDateString());
}));
});

describe('prettyTime', function() {
it('should turn a unix timestamp into a localized time string', inject(function(prettyTimeFilter) {
var d = new Date();
var ts = Math.floor(d.getTime()/1000);
expect(prettyTimeFilter(ts)).toBe(d.toLocaleTimeString());
}));
});

describe('prettyDateTime', function() {
it('should turn a unix timestamp into a localized time string', inject(function(prettyDateTimeFilter) {
var d = new Date();
var ts = Math.floor(d.getTime()/1000);
expect(prettyDateTimeFilter(ts)).toBe(d.toLocaleString());
}));
});

describe('arrLength', function() {
it('should return the proper length of a given array', inject(function(arrLengthFilter) {
expect(arrLengthFilter([0,1,2])).toBe(3);
Expand Down

0 comments on commit 08f7686

Please sign in to comment.