better initial load
This commit is contained in:
@@ -2,36 +2,15 @@
|
||||
* Comment System Utility Functions
|
||||
*
|
||||
* Shared utility functions for:
|
||||
* - Date formatting
|
||||
* - Comment sorting algorithms
|
||||
* - Comment filtering and tree building
|
||||
* - Debouncing
|
||||
*/
|
||||
|
||||
import type { Comment, CommentReaction, SortingMode } from "~/types/comment";
|
||||
import { getSQLFormattedDate } from "./date-utils";
|
||||
|
||||
// ============================================================================
|
||||
// Date Utilities
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Formats current date to match SQL datetime format
|
||||
* Note: Adds 4 hours to match server timezone (EST)
|
||||
* Returns format: YYYY-MM-DD HH:MM:SS
|
||||
*/
|
||||
export function getSQLFormattedDate(): string {
|
||||
const date = new Date();
|
||||
date.setHours(date.getHours() + 4);
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = `${date.getMonth() + 1}`.padStart(2, "0");
|
||||
const day = `${date.getDate()}`.padStart(2, "0");
|
||||
const hours = `${date.getHours()}`.padStart(2, "0");
|
||||
const minutes = `${date.getMinutes()}`.padStart(2, "0");
|
||||
const seconds = `${date.getSeconds()}`.padStart(2, "0");
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
export { getSQLFormattedDate };
|
||||
|
||||
// ============================================================================
|
||||
// Comment Tree Utilities
|
||||
|
||||
Reference in New Issue
Block a user