export function parseTimeToUnixEpoch()

in src/static/encoding.ts [94:121]


export function parseTimeToUnixEpoch(timeString) {
    const months = {
        "Jan": 0, "Feb": 1, "Mar": 2, "Apr": 3, "May": 4, "Jun": 5,
        "Jul": 6, "Aug": 7, "Sep": 8, "Oct": 9, "Nov": 10, "Dec": 11
    };

    // Split the string into parts
    const parts = timeString.split(" ");

    // Extract date components
    const day = parseInt(parts[0], 10);
    const month = months[parts[1]];
    const year = parseInt(parts[2], 10);

    // Extract time components
    const timeParts = parts[3].split(":");
    const hour = parseInt(timeParts[0], 10);
    const minute = parseInt(timeParts[1], 10);
    const second = parseInt(timeParts[2], 10);

    // Create a new Date object in UTC/GMT
    const date = new Date(Date.UTC(year, month, day, hour, minute, second));

    // Get the timestamp in milliseconds and convert to microseconds
    const microseconds = date.getTime() * 1000;

    return microseconds;
}