export function formatDate(dateString) {
    const date = new Date(dateString);

    const day = date.getUTCDate().toString().padStart(2, '0');
    const month = (date.getUTCMonth() + 1).toString().padStart(2, '0'); // getUTCMonth() returns 0-11
    const year = date.getUTCFullYear();

    return `${day}/${month}/${year}`;
}

export function formatCouponDate(dateString) {
    const [datePart] = dateString.split(' ');
    const [year, month, day] = datePart.split('-');
    return `${day}/${month}/${year}`;
}
export const convertToHKTime = (utcDateTimeString) => {
    const hkDate = new Date(utcDateTimeString).toLocaleString('en-HK', {
        timeZone: 'Asia/Hong_Kong',
        year: 'numeric',
        month: 'numeric',
        day: 'numeric'
    });
    const hkTime = new Date(utcDateTimeString).toLocaleString('en-HK', {
        timeZone: 'Asia/Hong_Kong',
        hour: '2-digit',
        minute: '2-digit',
        second: '2-digit',
        hour12: false
    });
    return { hkDate, hkTime };
};
// Example usage:
// const utcDateString = "2024-08-22T09:00:00.000Z";
// const hkTime = convertToHKTime(utcDateString);
// console.log(hkTime); // Output will be in the format: YYYY/MM/DD/HH/MM/SS
