maybe icon indicating copy to clipboard operation
maybe copied to clipboard

Fix test case in `date-utils.spec.ts`

Open crnsh opened this issue 1 year ago • 2 comments

Description

Fixes #182.

"converts between years and ages › dob 2022-10-15 is 0 years old today" test case fails because of rounding error and outputs -1. This fixes by making the minimum age be 0 as opposed to -1.

This happens because the dobToAge function uses { zone: 'utc' } but the test case doesn't.

Screenshots

Fixed - image

crnsh avatar Jan 19 '24 08:01 crnsh

Doesn't this just mask an underlying date utility issue?

Lewiscowles1986 avatar Jan 19 '24 08:01 Lewiscowles1986

@Lewiscowles1986 I initially thought it was an issue with DateTime (usually is the case, which is why libraries like Moment and DayJS are used), but turns out that the the function was converting it to a different time zone.

Have normalized the test timezones now.

crnsh avatar Jan 19 '24 12:01 crnsh