bookr-cli
Version:
A terminal-based CLI tool to book time in Jira using the Tempo plugin by parsing your current Git branch name
30 lines • 926 B
JavaScript
/**
* Format date range for display
*/
export function formatDateRange(startDate, endDate) {
const startFormatted = startDate.toLocaleDateString();
const endFormatted = endDate.toLocaleDateString();
return `${startFormatted} - ${endFormatted}`;
}
export function getTodayISO() {
return new Date().toISOString().slice(0, 10);
}
export function getYesterdayISO() {
const d = new Date();
d.setDate(d.getDate() - 1);
return d.toISOString().slice(0, 10);
}
/**
* Round a date down to the previous 15-minute mark
*/
export function roundToNearest15Minutes(date) {
const rounded = new Date(date);
const minutes = rounded.getMinutes();
const roundedMinutes = Math.floor(minutes / 15) * 15;
// Reset seconds and milliseconds
rounded.setSeconds(0, 0);
// Set to previous 15-minute mark
rounded.setMinutes(roundedMinutes);
return rounded;
}
//# sourceMappingURL=date.js.map