Kitz Forum

Chat => Tech Chat => Topic started by: chenks on July 19, 2019, 03:44:12 PM

Title: UK holiday entitlement & calculations
Post by: chenks on July 19, 2019, 03:44:12 PM
so i've been using the gov.uk website for a bit to calcaulate holiday entitlements for starters and leavers - https://www.gov.uk/calculate-your-holiday-entitlement/y

it all works fine, however i though it would be handy to have the actual calculation formula sitting offline rather than having to use the website all the time. they don't seem to want to give out the formula though. has anyone ever managed to work out what it is? or a way to scrape it from the sit?
Title: Re: UK holiday entitlement & calculations
Post by: gt94sss2 on July 19, 2019, 05:12:04 PM
Have a look at https://www.nidirect.gov.uk/articles/holiday-entitlements and perhaps https://www.nibusinessinfo.co.uk/content/know-how-much-holiday-give-your-staff
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 19, 2019, 06:48:10 PM
hmmm think you may have missed the point of the post.
it's not that i don't know that it's 5.6 weeks per year (or 28 days). it's what the formula is for working out what an entitlement is for a part year based on a specific start date etc.

the gov.uk gives you the number after you've asked all the questions, what i'm trying to scrape is what that actual formula is.

ie guys starts on 14 may 2019, holiday year starts on 1 jan 2019, works 5 days a week = 17.8 days (round up to 18).
Title: Re: UK holiday entitlement & calculations
Post by: gt94sss2 on July 19, 2019, 07:31:43 PM
Without calculating it myself, I think one of the links above answers this:

Quote
The holiday entitlement of 5.6 weeks is equivalent to 12.07 per cent of hours worked. The 12.07 per cent figure is 5.6 weeks' holiday, divided by 46.4 weeks (52 weeks - 5.6 weeks) and multiplied by 100 = 12.07 per cent.

Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 20, 2019, 01:37:29 PM
i don't think it does.
Title: Re: UK holiday entitlement & calculations
Post by: pooclah on July 20, 2019, 04:20:41 PM

You don't say whether the staff are full or part time, but this basic PowerShell script should work for both and point you in the right direction.

Code: [Select]
$ww = 5 # Number of days worked per week (max 5)
$he = $ww * 5.6 # Calculate entitlement
$d1 = '2019-05-14' # Start date
$d2 = '2019-12-31' # End date /end of year
$ts = New-TimeSpan -Start $d1 -End $d2
$weeks = $ts.Days / 7
[math]::round($he / 52 * $weeks, 1)

Kevin
Title: Re: UK holiday entitlement & calculations
Post by: parkdale on July 20, 2019, 05:07:19 PM
Try this one https://www.moorepay.co.uk/blog/holiday-entitlement-calculations-made-easy/
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 21, 2019, 05:23:30 PM
You don't say whether the staff are full or part time, but this basic PowerShell script should work for both and point you in the right direction.

Code: [Select]
$ww = 5 # Number of days worked per week (max 5)
$he = $ww * 5.6 # Calculate entitlement
$d1 = '2019-05-14' # Start date
$d2 = '2019-12-31' # End date /end of year
$ts = New-TimeSpan -Start $d1 -End $d2
$weeks = $ts.Days / 7
[math]::round($he / 52 * $weeks, 1)

Kevin

it would be all full time, but some are on 28 days (incl bank holidays) and some are on 33 days (incl bank holidays), but yeah all based on a 5 day working week.
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 21, 2019, 05:26:17 PM
Try this one https://www.moorepay.co.uk/blog/holiday-entitlement-calculations-made-easy/

that pages seems to base everything on someone starting on the 1st of each month or leaving at the end of each month, however if a person starts or leaves mid-month you must included the days for those part-months (as per government website). you are also not allowed to round down at any time, must always keep it as it is or round up (in reality it's always going to be rounded up unless it comes out as a full or half number).
Title: Re: UK holiday entitlement & calculations
Post by: pooclah on July 21, 2019, 07:51:30 PM

it would be all full time, but some are on 28 days (incl bank holidays) and some are on 33 days (incl bank holidays), but yeah all based on a 5 day working week.

Sorry for the brief response but I'm pressed for time.

for 28 days use 5.6
for 33 days use 6.6

Hope that makes sense.
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 22, 2019, 02:38:56 PM
You don't say whether the staff are full or part time, but this basic PowerShell script should work for both and point you in the right direction.

Code: [Select]
$ww = 5 # Number of days worked per week (max 5)
$he = $ww * 5.6 # Calculate entitlement
$d1 = '2019-05-14' # Start date
$d2 = '2019-12-31' # End date /end of year
$ts = New-TimeSpan -Start $d1 -End $d2
$weeks = $ts.Days / 7
[math]::round($he / 52 * $weeks, 1)

Kevin

yeah that seems to give the same result as the gov website based on the various date starts i've tested.

now, would that also be able to tell me how many days they have accrued to date? ie it has the start date and the current date and works out how many days accrued so far?
Title: Re: UK holiday entitlement & calculations
Post by: pooclah on July 22, 2019, 07:23:47 PM
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 23, 2019, 07:49:27 AM
i don't think that's quite right (unless i've mucked up the formula)

i just tried that formula based on someone leaving on 2nd august
gov website says 11.8 days, this formula gave 16.4 days

Code: [Select]
PS C:\Users\grays> $ww = 5 # Number of days worked per week (max 5)
>> $he = $ww * 5.6 # Calculate entitlement
>> $d1 = '2019-01-01' # Start date
>> $d2 = '2019-08-02' # End date /end of year
>> $ts = New-TimeSpan -Start $d1 -End $d2
>> $weeks = $ts.Days / 7
>> [math]::round($he / 52 * $weeks, 1)
16.4

(https://i.ibb.co/wrdhv70/Capture.jpg)
Title: Re: UK holiday entitlement & calculations
Post by: pooclah on July 23, 2019, 09:30:34 PM

The .gov site deducts bank holidays.

The basic script I provided just calculates entitlement based on weeks worked.  It's up to you to deduct bank holidays/days taken.

Kevin
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 24, 2019, 02:21:59 PM
does it deduct them? i can't see where it states that they are deducted.
the gov website uses 28 days as the base for the calculation.

banks holidays are included in the 28 (and 33 days) for the purposes of any calculations we do.
if people want the bank holidays off they have to take them as part of their holiday entitlement.
Title: Re: UK holiday entitlement & calculations
Post by: pooclah on July 26, 2019, 07:58:57 PM
Sorry for the delay – finally got home from work and had time for a quick look and read your reply properly.

Based on your input of:
Employment start date – 1 January 2019
Leave year start – 2 August 2019
I’m surprised the site gave you any answer.

Another way of looking at it is 28 / 52 * weeks worked

Kevin
Title: Re: UK holiday entitlement & calculations
Post by: chenks on July 27, 2019, 10:57:47 AM
i think the website results has displayed those two fields in the wrong place!

i suppose the question i'm asking is why is it divided by "weeks worked".
shouldn't it be "days worked", as unless you leave at the end of a full week then the calculation may end up being short?

not everyone starts at the beginning of a week and leaves at the end of a week.