adobe / aem-cif-project-archetype

Maven template to create new CIF Project AEM projects that follow best practices
Apache License 2.0
20 stars 12 forks source link

Updated date calculation for "New" #82

Closed godanny86 closed 4 years ago

godanny86 commented 4 years ago

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: