X-Git-Url: https://git.r.bdr.sh/rbdr/dasein/blobdiff_plain/287fa13b3e600b2340895a5463a288bf08101bb5..a6ccda0fbc4df683f9568d85eb22b21684d2a0bd:/app/filters/usertime.js diff --git a/app/filters/usertime.js b/app/filters/usertime.js new file mode 100644 index 0000000..de67894 --- /dev/null +++ b/app/filters/usertime.js @@ -0,0 +1,20 @@ +import Vue from 'vue'; + +const internals = {}; + +export default internals.UsertimeFilter = Vue.filter('usertime', (timestamp) => { + + const date = new Date(parseInt(timestamp)); + + const dateString = date.toISOString(); + + const dateComponents = dateString.split('T'); + const dateFragment = dateComponents[0]; + const timeComponents = dateComponents[1].split(':'); + + const hourFragment = timeComponents[0]; + const minuteFragment = timeComponents[1]; + + return `${dateFragment} ${hourFragment}:${minuteFragment}`; +}); +