I want to compare two dates to identify which date is older. The dates are stored in String format like
let stringA = "2022-11-14"
let stringB = "2022-11-13"
I can asure that all dates will be saved in this String format: yyyy-MM-dd
In my locale testing I was able to run
let compare = stringA > stringB
With various dates I always got the correct result true/false.
Is this the correct way of comparing those dates? Or should I use a DateFormatter to compare all those dates in Date format?
P.S. I know how two convert those Strings to Dates and compare them afterwards. I just want to avoid it if possible because the String comparison is shorter, easy to read and would save redundant code if possible.