diff --git a/bppoc/client/components/TransactionListItem.js b/bppoc/client/components/TransactionListItem.js index 6f06729..0abb122 100644 --- a/bppoc/client/components/TransactionListItem.js +++ b/bppoc/client/components/TransactionListItem.js @@ -1,7 +1,8 @@ import React from 'react' +import moment from 'moment' export default function TransactionListItem(props) { - const { + const { showFrom, showTo, transaction @@ -9,7 +10,7 @@ export default function TransactionListItem(props) { return ( - {convertDate(transaction.timestamp)} + {moment(transaction.timestamp*1000).format('llll')} { showFrom ? @@ -31,10 +32,3 @@ export default function TransactionListItem(props) { ) } - -function convertDate(timestamp) { - var d = new Date(timestamp * 1000) //x1000 to convert from seconds to milliseconds - var s = d.toUTCString(); - s = s.substring(0, s.indexOf("GMT")) + "UTC" //change the confusing 'GMT' to 'UTC' s - return s; -} diff --git a/bppoc/package-lock.json b/bppoc/package-lock.json index 5c9d3d7..953da33 100644 --- a/bppoc/package-lock.json +++ b/bppoc/package-lock.json @@ -4193,7 +4193,7 @@ "requires": { "hoek": "2.16.3", "isemail": "1.2.0", - "moment": "2.18.1", + "moment": "2.19.0", "topo": "1.1.0" }, "dependencies": { @@ -4754,9 +4754,9 @@ "integrity": "sha512-C8aapOvl77Bs18WCkejdLuX2kX8DaqaJ7ZmqUmX9U6HD2g31Pd0tZfNBAEVulmJWKyzUIyutrtxiIoNdXLAYsw==" }, "moment": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz", - "integrity": "sha1-w2GT3Tzhwu7SrbfIAtu8d6gbHA8=" + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.0.tgz", + "integrity": "sha1-RPZ172uUSUJ2JYGxwXn7Z55ZnWc=" }, "mongodb": { "version": "2.2.31", diff --git a/bppoc/package.json b/bppoc/package.json index 3cba57d..ca4e6ee 100644 --- a/bppoc/package.json +++ b/bppoc/package.json @@ -31,6 +31,7 @@ "graphql-tag": "^1.2.4", "html-webpack-plugin": "^2.26.0", "lodash": "^4.17.4", + "moment": "^2.19.0", "mongoose": "^4.7.8", "nodemon": "^1.12.1", "passport": "^0.3.2",