mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Merge branch 'master' of gitlab.com:MrFry/mrfrys-node-server
This commit is contained in:
commit
ce21f1b61b
3 changed files with 38 additions and 24 deletions
|
@ -83,19 +83,29 @@ const filterFromDailyStats = [
|
|||
const fs = require('fs') // eslint-disable-line
|
||||
|
||||
const dir = process.argv[2]
|
||||
const startDay = !isNaN(parseInt(process.argv[3])) && parseInt(process.argv[3]) > 0 ? 0 : parseInt(process.argv[3])
|
||||
if (!dir) {
|
||||
console.log('No params')
|
||||
process.exit()
|
||||
}
|
||||
|
||||
function getDayIndex(offset) {
|
||||
let os = offset
|
||||
if (!offset) {
|
||||
offset = 0
|
||||
os = 0
|
||||
}
|
||||
|
||||
if (!isNaN(startDay)) {
|
||||
if (!offset) {
|
||||
os = startDay
|
||||
} else {
|
||||
os = startDay + offset
|
||||
}
|
||||
}
|
||||
|
||||
const date = new Date()
|
||||
if (offset) {
|
||||
date.setDate(date.getDate() + offset)
|
||||
if (os) {
|
||||
date.setDate(date.getDate() + os)
|
||||
}
|
||||
return (
|
||||
date.getFullYear() +
|
||||
|
@ -172,7 +182,11 @@ function countLinesMatching(text, toMatch) {
|
|||
}
|
||||
|
||||
function getDayName(day) {
|
||||
switch (day) {
|
||||
let d = day
|
||||
if (!isNaN(startDay)) {
|
||||
d += startDay
|
||||
}
|
||||
switch (d) {
|
||||
case 0:
|
||||
case undefined:
|
||||
return 'Today'
|
||||
|
@ -181,7 +195,7 @@ function getDayName(day) {
|
|||
case -2:
|
||||
return 'Before yesterday'
|
||||
default:
|
||||
return `Day ${day.toString()}`
|
||||
return `Day ${d.toString()}`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue