aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-31 10:41:44 +0100
committerChocobozzz <me@florianbigard.com>2018-01-31 10:41:44 +0100
commit61bbc7277501692d1520a421dff5af5d38ba6cf4 (patch)
tree4c705f7f42f70fc33f5233a4d79b6a6826482cc5 /client/src/app/shared/misc
parent915c5bbe538769b1d3430b27817d6a861c766ef3 (diff)
downloadPeerTube-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.ts14
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
3import { DatePipe } from '@angular/common'
3import { environment } from '../../../environments/environment' 4import { environment } from '../../../environments/environment'
4import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
5 6
@@ -49,9 +50,20 @@ function getAbsoluteAPIUrl () {
49 return absoluteAPIUrl 50 return absoluteAPIUrl
50} 51}
51 52
53const datePipe = new DatePipe('en')
54function dateToHuman (date: string) {
55 return datePipe.transform(date, 'medium')
56}
57
58function isInMobileView () {
59 return window.innerWidth < 600
60}
61
52export { 62export {
53 viewportHeight, 63 viewportHeight,
54 getParameterByName, 64 getParameterByName,
55 populateAsyncUserVideoChannels, 65 populateAsyncUserVideoChannels,
56 getAbsoluteAPIUrl 66 getAbsoluteAPIUrl,
67 dateToHuman,
68 isInMobileView
57} 69}