This repository was archived by the owner on Apr 3, 2022. It is now read-only.
File tree 5 files changed +15
-40
lines changed
5 files changed +15
-40
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,3 @@ debug.out
12
12
coverage /
13
13
config.json
14
14
npm-debug.log
15
- build /
Original file line number Diff line number Diff line change 6
6
* zoom to extent of all requests when loading a bin
7
7
* catch invalid request URLs
8
8
* fix double-reporting pageview analytics bug (bump angulartics to 0.16.4)
9
+ * use angular date filter to normalize dates across browsers
9
10
10
11
# 1.0.2
11
12
* refactor services
Original file line number Diff line number Diff line change 33
33
} ;
34
34
} ] )
35
35
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
+ } ;
44
44
} ] )
45
45
46
46
// prettyDate
47
47
// ----------
48
48
// turns a unix timestamp into a localized date and time string
49
49
50
- . filter ( 'prettyDate ' , [ function ( ) {
50
+ . filter ( 'prettyTime ' , [ '$filter' , function ( $filter ) {
51
51
return function ( ts ) {
52
- return new Date ( ts * 1000 ) . toLocaleDateString ( ) ;
52
+ return $filter ( 'date' ) ( new Date ( ts * 1000 ) , 'hh:mm:ss a' ) ;
53
53
} ;
54
54
} ] )
55
55
56
- // prettyDateTime
57
- // --------------
56
+ // prettyDate
57
+ // ----------
58
58
// turns a unix timestamp into a localized date and time string
59
59
60
- . filter ( 'prettyDateTime ' , [ function ( ) {
60
+ . filter ( 'prettyDate ' , [ '$filter' , function ( $filter ) {
61
61
return function ( ts ) {
62
- return new Date ( ts * 1000 ) . toLocaleString ( ) ;
62
+ return $filter ( 'date' ) ( new Date ( ts * 1000 ) , 'MM/dd/yyyy' ) ;
63
63
} ;
64
64
} ] )
65
65
Original file line number Diff line number Diff line change 12
12
</ div >
13
13
< div class ="btn "
14
14
data-toggle ="tooltip " data-placement ="bottom " title ="date request was received ">
15
- < i class ="glyphicon glyphicon-calendar "> </ i >
16
15
{{item.timestamp | prettyDate}}
17
16
</ div >
18
17
</ div >
Original file line number Diff line number Diff line change @@ -31,30 +31,6 @@ describe('filters', function() {
31
31
} ) ) ;
32
32
} ) ;
33
33
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
-
58
34
describe ( 'arrLength' , function ( ) {
59
35
it ( 'should return the proper length of a given array' , inject ( function ( arrLengthFilter ) {
60
36
expect ( arrLengthFilter ( [ 0 , 1 , 2 ] ) ) . toBe ( 3 ) ;
You can’t perform that action at this time.
0 commit comments