mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2025-06-28 12:55:36 -04:00
adding mini msg board
Squashed commit of the following: commit5e685faff0
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Jan 1 20:39:19 2025 -0500 feat: mobile styling commit30a4ac6326
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Jan 1 16:51:53 2025 -0500 another test commitb847c0f231
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Jan 1 16:48:29 2025 -0500 fix: cf header commitacc580fb79
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Jan 1 16:46:22 2025 -0500 feat: add client ip tracking commit289b95d957
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Jan 1 16:40:49 2025 -0500 feat: add footer and styling commiteda40eb113
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Jan 1 14:59:35 2025 -0500 feat: added a comment section commit27840f3537
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Tue Dec 31 14:45:21 2024 -0500 css: black color commit3c3deda986
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Tue Dec 31 14:29:00 2024 -0500 ui: better design and stuff commitcd43c949aa
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Sat Dec 28 17:47:39 2024 -0500 fix: styling commit8c0a4a773e
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Sat Dec 28 14:32:07 2024 -0500 styling added + better templates commit0a21838c91
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Fri Dec 27 22:33:44 2024 -0500 fix: create tables commit77832d73de
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Fri Dec 27 22:21:48 2024 -0500 dockerfile_update commit90769c9bf1
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Fri Dec 27 22:17:36 2024 -0500 more code commite07590d6e5
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Thu Dec 26 08:15:00 2024 -0500 updates commit1d28883841
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Thu Dec 26 07:38:38 2024 -0500 updated docker file commiteb3068af96
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Thu Dec 26 07:27:38 2024 -0500 added dockerfile commit15a77883f4
Author: Mike Smith <89040888+smiggiddy@users.noreply.github.com> Date: Wed Dec 25 22:45:54 2024 -0500 basic msg board
This commit is contained in:
parent
b66089f97e
commit
59a08e23a9
23 changed files with 3198 additions and 0 deletions
25
nodejs-mini-message-board/src/utils.js
Normal file
25
nodejs-mini-message-board/src/utils.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
function dateParser(date) {
|
||||
/* Returns a time/date formatted string
|
||||
* based on the age of the log entry.
|
||||
* > 24 hrs return the date
|
||||
* < 24 hrs > 1 hr return the number of hours
|
||||
* otherwise return the minutes since the log was entered
|
||||
*/
|
||||
const currentTime = new Date();
|
||||
|
||||
const difference = Math.floor((currentTime - date) / 1000);
|
||||
|
||||
if (difference >= 86400) {
|
||||
// Return date since entry is older than a day
|
||||
const newDate = new Date(date);
|
||||
return newDate.toLocaleString();
|
||||
} else if (difference >= 3600) {
|
||||
// Return hours since log entry
|
||||
return `${Math.floor(difference / 3600)}h`;
|
||||
} else {
|
||||
// Reteurn Minutes since log entry
|
||||
return `${Math.floor(difference / 60)}m`;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { dateParser };
|
Loading…
Add table
Add a link
Reference in a new issue