Remove duplicate utility code via shared formatting module

Consolidate MONTH_NAMES, PALETTE, formatCurrency, formatCurrencyShort,
ordinal, and fmt into client/src/utils/formatting.js. Consolidate
CONFIG_KEYS into server/src/constants.js. All consumer files updated
to import from these shared modules. PaycheckView re-exports formatCurrency,
ordinal, and formatPayDate for backward compatibility with existing tests.

Nightshift-Task: dead-code
Nightshift-Ref: https://github.com/marcus/nightshift
This commit is contained in:
2026-03-20 02:22:04 -04:00
parent ccd0fb2155
commit c69984898b
9 changed files with 53 additions and 94 deletions

12
server/src/constants.js Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
const CONFIG_KEYS = [
'paycheck1_day',
'paycheck2_day',
'paycheck1_gross',
'paycheck1_net',
'paycheck2_gross',
'paycheck2_net',
];
module.exports = { CONFIG_KEYS };

View File

@@ -1,15 +1,7 @@
const express = require('express');
const router = express.Router();
const { pool } = require('../db');
const CONFIG_KEYS = [
'paycheck1_day',
'paycheck2_day',
'paycheck1_gross',
'paycheck1_net',
'paycheck2_gross',
'paycheck2_net',
];
const { CONFIG_KEYS } = require('../constants');
const DEFAULTS = {
paycheck1_day: 1,

View File

@@ -2,15 +2,7 @@ const express = require('express');
const router = express.Router();
const { pool } = require('../db');
const { calcPaymentAmount } = require('./financing');
const CONFIG_KEYS = [
'paycheck1_day',
'paycheck2_day',
'paycheck1_gross',
'paycheck1_net',
'paycheck2_gross',
'paycheck2_net',
];
const { CONFIG_KEYS } = require('../constants');
const CONFIG_DEFAULTS = {
paycheck1_day: 1,