Issue with date



who is the right now?

When you calculate the number of days from January 1, 2024, to December 31, 2024, you get 365 days because you’re looking at the days in that period, not the whole year. Even though 2024 is a leap year with 366 days in total, the time from the start to the end of the year covers 365 days.

okey i does not understand it well
let us test this example:
3/6/2024 - 4/6/2024
the actually period is 48 hours 24 form first day and 24 from another day
so the days are two not one ?
@NCP

frappe.utils.date_diff("4-6-2024", "3-6-2024") gives 1 day because it counts the full days from the start of June 3 to the start of June 4.

So, even though 2024 is a leap year, the period from January 1 to December 31 is 365 days because it doesn’t count the end date itself.

Both are right.

1 and 2 are two numbers, but difference of these two is 1.

2 - 1 = 1

Same logic is true for days.

thanks for this info

thanks for your response