UNPKG

qa-shadow-report

Version:

npm package that prints formatted test reports into a google sheet or csv file

28 lines (24 loc) 788 B
import { getFormattedMonth, getPreviousMonthsYear, } from '../../sharedMethods/dateFormatting.js'; /** * Creates a title for a summary report based on the previous month and year. * @returns {string} The title for the summary report. */ export const createSummaryTitle = () => { try { const lastMonth = getFormattedMonth('lastMonth'); const currentMonth = getFormattedMonth(); const previousMonthsYear = getPreviousMonthsYear(currentMonth); if (!lastMonth || !previousMonthsYear) { throw new Error( 'Could not generate summary title due to date formatting error.' ); } return `Monthly summary ${lastMonth} ${previousMonthsYear}`; } catch (error) { console.error('Error in createSummaryTitle:', error); throw error; } };