21
Views
5
Comments
I want to calculate the age without satuday and sunday
Application Type
Reactive

I have one block called claim list in which i am fetching data from database. And showing that data in the table. In that i have one column called CreatedOn which is of Date type. I want to calculate CreatedOn-Currdate (Without satuday and sunday). 
For Example : CreatedOn =2024-11-05 & CurrDate =2024-11-11 so on 9th and 10th nov we have saturday and sunday so i want to display calculate age as: 4
If anyone is able to use onAfter fetch on the attribute then it will solve my another problem also.

2026-03-12 06-20-48
KUNDAN CHAUHAN
Champion
2024-09-24 11-15-33
Vinay Bhirud

Can anyone send me oml file with this logic. It will help me to integrate that functionality.
Thank you


UserImage.jpg
Ojasvi Sharma

Hi @Vinay Bhirud

I hope you are doing well. 

Below is the oml file for your problem, you can take the reference from. I hope it helps. 

Regards, 

Ojasvi Sharma

CalculateAge.oml
2024-12-02 13-16-47
Vipin Yadav

Hi Vinay Bhirud,

I have included the OML with the updates, please check.

Demo url -

 https://vyadav.outsystemscloud.com/AgeWithoutSatudayAndSunday/AgeWithoutSatudayAndSunday



AgeWithoutSatudayAndSunday.oml
2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Vinay Bhirud 

You can use this js code to archive this you only need to pass them from date and to date 

This function calculates the age between two dates, excluding Saturdays and Sundays, and returns the result in years, months, and days based on weekdays only.

Parameters:

  • fromDate (String or Date): The start date of the age calculation. This can be a string in YYYY-MM-DD format or a Date object.
  • toDate (String or Date): The end date of the age calculation. This can also be a string in YYYY-MM-DD format or a Date object.

Added OML you can check for your reference



Thanks 

Regards Gourav Shrivastava



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