Skip to content

Change format of whenDeleted to YYYY-MM-DD HH:MM:SS #4

@rschouten97

Description

@rschouten97

The whenDeleted field in the blacklist table is currently mapped to use the date format DD-MM-YYYY HH:MM:SS (e.g., 31-3-2025 14:54:49). This format is causing issues with date conversion. The correct format should be YYYY-MM-DD HH:MM:SS (e.g., 2025-03-31 14:54:49).

Steps to Reproduce:

  1. Update the whenDeleted field with a date in the format DD-MM-YYYY HH:MM:SS.
  2. Observe the conversion error.

Proposed Solution:
Update the date format to YYYY-MM-DD HH:MM:SS. This can be accomplished using the following JavaScript code:

function convertDate(date) {
    const day = String(date.getDate()).padStart(2, '0');
    const month = String(date.getMonth() + 1).padStart(2, '0');
    const year = date.getFullYear();
    const hours = String(date.getHours()).padStart(2, '0');
    const minutes = String(date.getMinutes()).padStart(2, '0');
    const seconds = String(date.getSeconds()).padStart(2, '0');
    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

function getFormattedDate() {
    const date = new Date();
    return isNaN(date) ? "" : convertDate(date);
}

getFormattedDate();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions