Custom script to fetch monthly holidays per month into a custom field in salary slip

is it possible to filter and fetch holiday count per month based on payroll period using only custom Js script.