Why don't my Photos sort correctly by date? Using OS 10.12.4 and Photos 2.0 (3150.4.120).

I imported a bunch of photos recently, and selected View > Sort > "Keep Sorted by Oldest First".

Most of them appear in the correct order, but a few are out of order. If I do Get Info on them, I can see that certain photos have a later date than photos appearing later in the album.

Is this sort order based on a different date? How can I make them appear in the right order? Or is this just a bug in Photos (in which case I'll abandon hope)?

It also uses this same incorrect order on iOS 10.3.1, when I sync them to my iPhone.

I tried putting them in a new album, as well as creating a Smart Album with the photos, but the same order persists.
Okay, I solved the mystery.

All of the photos in question were taken when I was on vacation, and my phone's time zone was set to the "away" time zone. Most of the photos were correctly saved with that time zone.

But for some reason, a few photos (the out-of-order ones) were saved with my "home" time zone. These photos also had no GPS location saved, so I assume this is a bug that happens when it can't find your GPS location.

Interestingly, the out-of-order photos did have the correct time, for the "away" time zone. It was just the time zone itself that was off. That's why it wasn't obvious that their time was wrong; Photos doesn't normally display the time zone. The only way to find out is to select "Adjust Date and Time", since that dialog shows you the photo's current time zone.

To fix this, I had to find all the out-of-order photos. Since Photos has no obvious way to filter Smart Albums by time zone, I filtered by "Photo is not tagged with GPS". (EDIT: I ended up writing a script to find them, since this didn't find all the right ones.)

I selected these photos, selected "Adjust Date and Time", entered the "away" time zone, then adjusted the time back to the original. That way it changed the time zone without affecting the actual time.

Afterwards, my photos were sorted correctly.