style: run prettier on entire codebase
This commit is contained in:
@@ -21,7 +21,7 @@ function getEasterSunday(year: number): string {
|
||||
const m = Math.floor((a + 11 * h + 22 * l) / 451);
|
||||
const month = Math.floor((h + l - 7 * m + 114) / 31);
|
||||
const day = ((h + l - 7 * m + 114) % 31) + 1;
|
||||
return `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
||||
return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
||||
}
|
||||
|
||||
/** All Czech public holidays for a year (11 fixed + 2 Easter-based) */
|
||||
@@ -51,8 +51,9 @@ export function getHolidays(year: number): string[] {
|
||||
const easterMonday = new Date(easterDate);
|
||||
easterMonday.setDate(easterMonday.getDate() + 1);
|
||||
|
||||
const fmt = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
||||
holidays.push(fmt(goodFriday)); // Velký pátek
|
||||
const fmt = (d: Date) =>
|
||||
`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
||||
holidays.push(fmt(goodFriday)); // Velký pátek
|
||||
holidays.push(fmt(easterMonday)); // Velikonoční pondělí
|
||||
|
||||
holidays.sort();
|
||||
@@ -67,7 +68,11 @@ export function isHoliday(dateStr: string): boolean {
|
||||
}
|
||||
|
||||
/** Business days in a month (Mon-Fri excluding public holidays) */
|
||||
export function getBusinessDaysInMonth(year: number, month: number, upToDay?: number): number {
|
||||
export function getBusinessDaysInMonth(
|
||||
year: number,
|
||||
month: number,
|
||||
upToDay?: number,
|
||||
): number {
|
||||
const holidays = getHolidays(year);
|
||||
let count = 0;
|
||||
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
||||
@@ -77,7 +82,7 @@ export function getBusinessDaysInMonth(year: number, month: number, upToDay?: nu
|
||||
const date = new Date(year, month, day);
|
||||
const dow = date.getDay();
|
||||
if (dow !== 0 && dow !== 6) {
|
||||
const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
||||
const dateStr = `${year}-${String(month + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
||||
if (!holidays.includes(dateStr)) {
|
||||
count++;
|
||||
}
|
||||
@@ -87,6 +92,10 @@ export function getBusinessDaysInMonth(year: number, month: number, upToDay?: nu
|
||||
}
|
||||
|
||||
/** Monthly work fund in hours (business days × 8) */
|
||||
export function getMonthlyWorkFund(year: number, month: number, upToDay?: number): number {
|
||||
export function getMonthlyWorkFund(
|
||||
year: number,
|
||||
month: number,
|
||||
upToDay?: number,
|
||||
): number {
|
||||
return getBusinessDaysInMonth(year, month, upToDay) * 8;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user