aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-16 23:59:32 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:52 +0300
commit1b7e41480e213d1f214c368f553d5eb03fb70897 (patch)
treee1f5642c3d2e7c6d29c39dfc879de583eebcd742
parentce9d9ed32757e30c32fa9fe29d04491c3d0550d1 (diff)
moment.js
-rw-r--r--vnext/package.json1
-rw-r--r--vnext/src/components/Message.js5
-rw-r--r--vnext/webpack.config.js2
-rw-r--r--vnext/yarn.lock4
4 files changed, 10 insertions, 2 deletions
diff --git a/vnext/package.json b/vnext/package.json
index b9da239e..da21b308 100644
--- a/vnext/package.json
+++ b/vnext/package.json
@@ -35,6 +35,7 @@
]
},
"dependencies": {
+ "moment": "^2.22.2",
"query-string": "^6.1.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js
index 9fce97d9..ed0d1857 100644
--- a/vnext/src/components/Message.js
+++ b/vnext/src/components/Message.js
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import ReactMarkdown from 'react-markdown';
+import moment from 'moment';
import Icon from './Icon';
@@ -19,8 +20,8 @@ export default function Message(props) {
<div className="msg-ts">
<a href={`/${msg.user.uname}/${msg.mid}`}>
<time itemProp="datePublished dateModified" itemType="http://schema.org/Date" dateTime={msg.timestamp}
- title={msg.timestamp}>
- {msg.timestamp}
+ title={moment.utc(msg.timestamp).local().format('lll')}>
+ {moment.utc(msg.timestamp).fromNow()}
</time>
</a>
</div>
diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js
index 97eeeb83..298ebde2 100644
--- a/vnext/webpack.config.js
+++ b/vnext/webpack.config.js
@@ -1,3 +1,4 @@
+const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const history = require('connect-history-api-fallback');
const convert = require('koa-connect');
@@ -41,6 +42,7 @@ module.exports = {
]
},
plugins: [
+ new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new MiniCssExtractPlugin({ filename: "Juick.css", allChunks: true })
],
};
diff --git a/vnext/yarn.lock b/vnext/yarn.lock
index 4773f3cb..6081581d 100644
--- a/vnext/yarn.lock
+++ b/vnext/yarn.lock
@@ -3081,6 +3081,10 @@ mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1:
dependencies:
minimist "0.0.8"
+moment@^2.22.2:
+ version "2.22.2"
+ resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
+
move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"