51
Views
2
Comments
About Date calculation
Question
Application Type
Reactive

Hi all

I would like to ask you about date calculation.

There are two input widgets, 'Joining Date' and 'Contract End Date' for employee management system. When I enter the date of joining, I want the 'contract end date' to be reflected automatically.

By the way, the date is selected with date picker.

The calculation is different for temporary employees and part-timers. For temporary employees is 4 months, at the end of the month. 
Part-timers are determined by the company's employees. 
ex. joining date: Jun 1st end date: August 31st

What should I do with these definitions?

I tried the following, but it doesn't work.

===
var employeeType: Employee[] = {  
{id:0 name:temporary};  {id:1 name:PartTime};
};

var startDate = $('.calender hasdatapicker').datapicker('getDate')
var expireDate= dt.setMonth(dt.getMonth() + 3);
this.options.form.getWidgetByName("name").setValue(expireDate);

=== 

Regards,

Asami

2020-11-25 10-45-32
Mostafa Othman
Champion

You can add your logic into OnChange action of your date picker. you can use built-in function AddMonths(JoiningDate,4 ) in case temporary employee to calculate end date also you can use if condition or switch based on number of employees types

UserImage.jpg
vikas sharma
Champion

Hi,

You simply add one listener onchange on first date (Joining date). In this you will get the value of the date entered and add logic for calculating the contract end date. For creating contract end date you can use already defiend date methods. Then assign the resulted date to the variable which holds the value of contract end date.

regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.