Untitled

 avatar
unknown
plain_text
a year ago
920 B
3
Indexable
if (updatedData) {
    const dueDate = new Date(updatedData.dueDT);
    const formattedDueDt = updatedData.status === 'DT'
        ? dueDate.toISOString().split('T')[0]
        : formatDate(updatedData.neededBy);

    const updatedRfiRequest = {
        ...updatedData,
        category: updatedData.category.split(','),
        programs: updatedData.programs.split(','),
        neededBy: formattedDueDt,
        requestedBy: updatedData.state,
    };
    updateRFIRequest(updatedRfiRequest);
    Lift.Application.Notification.success('Draft saved successfully');
}

// Helper function to format date in dd-mm-yyyy format
function formatDate(dateString) {
    const date = new Date(dateString);
    const day = String(date.getDate()).padStart(2, '0');
    const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
    const year = date.getFullYear();
    return `${day}-${month}-${year}`;
}

Editor is loading...
Leave a Comment