function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ARCHIT PathakARCHIT Pathak 

Calculate number of days between saturday and sunday.

Hi,

I'm trying to calculate the number of days between Saturday and Sunday by using daysBetween(toStartofWeek).

If it's 0, I count it as a Sunday, if it's -6, I count it as a Saturday.

This was working fine until I saw this link and changed the user locale

https://help.salesforce.com/articleView?id=admin_supported_date_time_format.htm&type=5

Now as per this post, for some locales 0 will be Monday and for some -6 will be a Friday.

I thought of using a map, but I'm already using one to set locale adjusted date format.

Can anyone help me in resolving this as per logged in user's locale(which I am getting correctly)?

SabrentSabrent
if you haven't looked, this blog post might help you - 
https://laceysnr.com/user-locales-and-the-start-of-the-week/