This is a minor change to the sample ProductTeaser extension and I know its sample code but it confused me when I was looking at the data in Magento.
The isShowBadge() logic calculated the number of days between when the product was created and the current date, but did not take into account Months and years. I.e if the created date was 2019-02-02 and the current date is 2020-02-012 the calculation would return 10 days when its actually 375...
This is a minor change to the sample ProductTeaser extension and I know its sample code but it confused me when I was looking at the data in Magento.
The
isShowBadge()
logic calculated the number of days between when the product was created and the current date, but did not take into account Months and years. I.e if the created date was 2019-02-02 and the current date is 2020-02-012 the calculation would return 10 days when its actually 375...see https://docs.oracle.com/javase/tutorial/datetime/iso/period.html
Screenshots (if appropriate):
Types of changes
Checklist: