getDateDiff and years #14562
Replies: 5 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for your reply.
|
Beta Was this translation helpful? Give feedback.
-
Thanks @pdanpdan |
Beta Was this translation helpful? Give feedback.
-
I think @rstoenescu can decide this. |
Beta Was this translation helpful? Give feedback.
-
Hi @rstoenescu, what do you say? I prefer to do it after you will say this is acceptable by you so let me know. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi
I need to have the difference between 2 dates in years unit so I'm using date.getDateDiff with 2 options 'year' and years'.
What is the difference between 'year' and 'years'? Both gave me the same result.
When using 'year', I see the following error
which is coming from here:
function getDateDiff(date: Date | number | string, subtract: Date | number | string, unit?:
${DateUnitOptions}s): number;
and based on this thread: Bug in template used to generatedate.d.ts
causes compilation errors. #12616 it was done on purpose but I don't understand the logic of this additional 's' at the end, it causing 'year' to be 'years' and 'years' to be 'yearss'.When asking for the difference in years, I want it to be the actual years so if the date is 2000-10-10, I expect 2022-10-09 to return 11 and 2022-10-11 to return 12. Is it possible and I missed something or this is not the intention of this method?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions