As per the UAE labor law, gratuity calculation is done based on the type of contract under which the employee was employed.
This article explains how to calculate gratuity for a limited contract i.e. a contract with an end date. Gratuity calculation for an unlimited contract is explained here.
Less than 1 year of service
Leaving work before completing one (1) year of service means that you are not entitled to any gratuity pay.
Between 1 year and 5 years of service
Employee is entitled to full gratuity pay based on 21 days salary for each year of work.
E.g. Employee with a basic salary AED 10,000 who has completed one year of work
10,000/30 = AED 333.33
AED 333.33*21*1 = AED 7,000
5 or more years of service
Employee is entitled to full gratuity pay based on 30 days salary for each year of work.
E.g. Employee with a basic salary AED 10,000 who has completed five years of work
10,000/30 = AED 333.33
AED 333.33*30*5 = AED 50,000
Note: These calculations are not to be treated as law, they are for your reference only. For any disputes or further clarification, contact the UAE Ministry of Human Resources and Emiratization.