testify icon indicating copy to clipboard operation
testify copied to clipboard

Add TimeEqual function to better compare times

Open annarosenthal opened this issue 3 years ago • 1 comments

Summary

In order to fix JSON-unmarshalled comparison (https://github.com/stretchr/testify/issues/1160), we've added a new function TimeEqual() that compares timestamps instead of time.Time fields. This also allows you to compare times with different time zones.

Changes

  • added TimeEqual to compare by timestamps

Motivation

To fix https://github.com/stretchr/testify/issues/1160 and to allow comparison with different time zones.

Related issues

Closes https://github.com/stretchr/testify/issues/1160

annarosenthal avatar Jul 31 '22 19:07 annarosenthal

assert.Equal() already supports time.Time values.

dolmen avatar Oct 30 '23 23:10 dolmen