Skip to content

POST dates‐to‐half‐quarter‐dates

Justin Meyer edited this page Oct 25, 2024 · 1 revision

Get rounded dates to the nearest half quarter (~6 weeks)

const testData = {
    startDate: "2024-10-12",  // Example valid date
    dueDate: "2024-10-18"     // Example valid date
};

// Make a POST request to the `/dates` endpoint
fetch('http://auto-scheduler.bitovi-jira.com/dates-to-half-quarter-dates', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    body: JSON.stringify(testData),
})
    .then(response => {
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.json();
    })
    .then(data => {
        console.log('Response:', data);
    })
    .catch(error => {
        console.error('Error:', error);
    });

Returns:

{"roundedStart":"2024-10-01","roundedDue":"2024-11-15"}