mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 14:44:13 +00:00
parent
36aef26ce9
commit
08682d2448
4 changed files with 9 additions and 10 deletions
|
@ -9,7 +9,6 @@ const fs = require("fs");
|
|||
const net = require("net");
|
||||
const bcrypt = require("bcryptjs");
|
||||
const colors = require("chalk");
|
||||
const moment = require("moment");
|
||||
|
||||
let homePath;
|
||||
let configPath;
|
||||
|
@ -32,7 +31,6 @@ const Helper = {
|
|||
setHome,
|
||||
getVersion,
|
||||
getGitCommit,
|
||||
getHumanDate,
|
||||
ip2hex,
|
||||
mergeConfig,
|
||||
getDefaultNick,
|
||||
|
@ -208,10 +206,6 @@ function passwordCompare(password, expected) {
|
|||
return bcrypt.compare(password, expected);
|
||||
}
|
||||
|
||||
function getHumanDate() {
|
||||
return moment().format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
|
||||
function getDefaultNick() {
|
||||
if (!this.config.defaults.nick) {
|
||||
return "thelounge";
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const colors = require("chalk");
|
||||
const read = require("read");
|
||||
const Helper = require("./helper");
|
||||
const moment = require("moment");
|
||||
|
||||
function timestamp() {
|
||||
return colors.dim(Helper.getHumanDate());
|
||||
return colors.dim(module.exports.getHumanDate());
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -31,4 +31,8 @@ module.exports = {
|
|||
options.prompt = [timestamp(), colors.cyan("[PROMPT]"), options.text].join(" ");
|
||||
read(options, callback);
|
||||
},
|
||||
|
||||
getHumanDate() {
|
||||
return moment().format("YYYY-MM-DD HH:mm:ss");
|
||||
},
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ class TextFileMessageStorage {
|
|||
return;
|
||||
}
|
||||
|
||||
let line = `[${Helper.getHumanDate()}] `;
|
||||
let line = `[${log.getHumanDate()}] `;
|
||||
|
||||
// message types from src/models/msg.js
|
||||
switch (msg.type) {
|
||||
|
|
|
@ -4,6 +4,7 @@ const expect = require("chai").expect;
|
|||
const os = require("os");
|
||||
const moment = require("moment");
|
||||
const Helper = require("../../src/helper");
|
||||
const log = require("../../src/log");
|
||||
|
||||
describe("Helper", function() {
|
||||
describe("#expandHome", function() {
|
||||
|
@ -55,6 +56,6 @@ describe("Helper", function() {
|
|||
});
|
||||
|
||||
describe("#getHumanDate()", function() {
|
||||
expect(Helper.getHumanDate()).to.equal(moment().format("YYYY-MM-DD HH:mm:ss"));
|
||||
expect(log.getHumanDate()).to.equal(moment().format("YYYY-MM-DD HH:mm:ss"));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue