I am dealing with specific request from my users, that I am unable to "break".
Situation:
we work with historic data, that sometimes have uknown date values. We, for example, know, that something happend in year 1943, but we do not know when exactly, what day and what month. Sometimes we do have exact dates. We work with dates from-to, and usualy those are chained so when one event ends, the other starts. You can think of these events for example as dates when a ship was on sea, and in harbor.
Example:
we have two records (in this example, in real we can have dozens of those in one post), with such a structure
Date From - Date To - Event
01.01.1943 - 01.02.1943 - Event 1
DD.MM.1943 - 01.04.1943 - Event 2
01.04.1943 - DD.11.1943 - Event 3
DD.02.1943 - 28.02.1943 - Event 4
DD and MM stays for "day uknown" and "month uknown", so the format of the date stays in DD.MM.YYYY format for further processing.
Problem:
human eye and brain can quickly sort out, that there are two events related - are one after the other, as it sees the "date to" in event 2 to be equal to "date from" in event 3, and sort them in correct order. But, when I want to do it in code, I use some php array_sort function (and sort it only by dateFrom for example), i will get this BAD order
Date From - Date To - Event
01.01.1943 - 01.02.1943 - Event 1
01.04.1943 - DD.11.1943 - Event 3
DD.02.1943 - 28.02.1943 - Event 4
DD.MM.1943 - 01.04.1943 - Event 2
due to order of "01" in alphabet preceding "DD" string. Expected CORRECT order
Date From - Date To - Event
01.01.1943 - 01.02.1943 - Event 1
DD.02.1943 - 28.02.1943 - Event 4
DD.MM.1943 - 01.04.1943 - Event 2
01.04.1943 - DD.11.1943 - Event 3
Is there a way, how to order this in the same way the human brain would? I honestly have no idea, how to aproach this.
Thank you