Skip to content

Comparing with .isTomorrow, .isYesterday, .isLastWeek.. etc is giving wrong value #125

@iranjith4

Description

@iranjith4

When comparing yesterday's date with .compare(.isTomorrow), the function is returning true which is wrong.

Example:

let date = Date()
let tomorrow = date.offset(.day, value: 1)!
let yesterday = date.offset(.day, value: -1)!

//In version 5.0.1, these comparison returns `true`, which is a bug. 

if tomorrow.compare(.isYesterday) { 
    print(".isYesterday COMPARISION WRONG")
}

if yesterday.compare(.isTomorrow) {
    print(".isTomorrow COMPARISION WRONG")
}

The same happens for comparing the following DateComparisonType

isYesterday, isTomorrow, isLastWeek, isNextWeek, isLastMonth, isNextMonth, isLastYear, isNextYear 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions