diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-31 10:41:44 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-31 10:41:44 +0100 |
commit | 61bbc7277501692d1520a421dff5af5d38ba6cf4 (patch) | |
tree | 4c705f7f42f70fc33f5233a4d79b6a6826482cc5 /client/src/app/shared/misc | |
parent | 915c5bbe538769b1d3430b27817d6a861c766ef3 (diff) | |
download | PeerTube-61bbc7277501692d1520a421dff5af5d38ba6cf4.tar.gz PeerTube-61bbc7277501692d1520a421dff5af5d38ba6cf4.tar.zst PeerTube-61bbc7277501692d1520a421dff5af5d38ba6cf4.zip |
Fix human dates in result lists
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r-- | client/src/app/shared/misc/utils.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index 23b46812b..0e6e6b366 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript | 1 | // Thanks: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript |
2 | 2 | ||
3 | import { DatePipe } from '@angular/common' | ||
3 | import { environment } from '../../../environments/environment' | 4 | import { environment } from '../../../environments/environment' |
4 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
5 | 6 | ||
@@ -49,9 +50,20 @@ function getAbsoluteAPIUrl () { | |||
49 | return absoluteAPIUrl | 50 | return absoluteAPIUrl |
50 | } | 51 | } |
51 | 52 | ||
53 | const datePipe = new DatePipe('en') | ||
54 | function dateToHuman (date: string) { | ||
55 | return datePipe.transform(date, 'medium') | ||
56 | } | ||
57 | |||
58 | function isInMobileView () { | ||
59 | return window.innerWidth < 600 | ||
60 | } | ||
61 | |||
52 | export { | 62 | export { |
53 | viewportHeight, | 63 | viewportHeight, |
54 | getParameterByName, | 64 | getParameterByName, |
55 | populateAsyncUserVideoChannels, | 65 | populateAsyncUserVideoChannels, |
56 | getAbsoluteAPIUrl | 66 | getAbsoluteAPIUrl, |
67 | dateToHuman, | ||
68 | isInMobileView | ||
57 | } | 69 | } |