Search: Allow sorting of results by UTC instead of local time #2027

Open
opened 2026-02-20 01:04:44 -05:00 by deekerman · 3 comments
Owner

Originally created by @martyone on GitHub (Jan 31, 2024).

1. What is not working as documented?

In the Search view, with Newest First order. A photo and a video taken shortly one after the other appear in wrong order. This happens when the recording device uses time zone other than UTC. In such case the time recorded in video metadata is UTC (standard behavior IIUC) while the time recorded in photo metadata may be local time with time zone information. As mentioned here https://github.com/photoprism/photoprism/issues/2265#issuecomment-1101712272 PhotoPrism seems to sort them based on the "local time", i.e., ignoring the time offset, which seems to explain what I see.

2. How can we reproduce it?

Steps to reproduce the behavior:

  1. Record a photo, then a video and another photo at last with a camera with time zone other than UTC set.
  2. Import them in PhotoPrism
  3. Go to the search view, Newest First
  4. The video appears before or after the photos depending on the time zone offset (positive or negative)

3. What behavior do you expect?

The video appears between the two photos, exactly in the order they were taken in.

4. What could be the cause of your problem?

As mentioned here https://github.com/photoprism/photoprism/issues/2265#issuecomment-1101712272 PhotoPrism seems to sort them based on the "local time", i.e., ignoring the time offset.

5. Can you provide us with example files for testing, error logs, or screenshots?

These three files are displayed in wrong order by PhotoPrism - the video appears after the photos with the Newest First ordering.

~ $ exiftool DSC_1892.JPG|grep -e Date -e Offset
File Modification Date/Time     : 2024:01:28 10:24:47+01:00
File Access Date/Time           : 2024:01:31 17:28:44+01:00
File Inode Change Date/Time     : 2024:01:31 17:28:43+01:00
Modify Date                     : 2024:01:28 10:24:47
Date/Time Original              : 2024:01:28 10:24:47
Create Date                     : 2024:01:28 10:24:47
Offset Time                     : +01:00
Offset Time Original            : +01:00
Offset Time Digitized           : +01:00
Date Display Format             : D/M/Y
Number Offsets                  : 31
Thumbnail Offset                : 31484
Create Date                     : 2024:01:28 10:24:47.83+01:00
Date/Time Original              : 2024:01:28 10:24:47.83+01:00
Modify Date                     : 2024:01:28 10:24:47.83+01:00
~ $ exiftool DSC_1893.mp4|grep -e Date -e Offset
File Modification Date/Time     : 2024:01:28 10:25:38+01:00
File Access Date/Time           : 2024:01:31 17:28:45+01:00
File Inode Change Date/Time     : 2024:01:31 17:28:43+01:00
Media Data Offset               : 48
Create Date                     : 2024:01:28 09:25:38
Modify Date                     : 2024:01:28 09:25:38
Track Create Date               : 2024:01:28 09:25:38
Track Modify Date               : 2024:01:28 09:25:38
Media Create Date               : 2024:01:28 09:25:38
Media Modify Date               : 2024:01:28 09:25:38
~ $ exiftool DSC_1898.JPG|grep -e Date -e Offset
File Modification Date/Time     : 2024:01:28 10:28:23+01:00
File Access Date/Time           : 2024:01:31 17:28:45+01:00
File Inode Change Date/Time     : 2024:01:31 17:28:43+01:00
Modify Date                     : 2024:01:28 10:28:23
Date/Time Original              : 2024:01:28 10:28:23
Create Date                     : 2024:01:28 10:28:23
Offset Time                     : +01:00
Offset Time Original            : +01:00
Offset Time Digitized           : +01:00
Date Display Format             : D/M/Y
Number Offsets                  : 31
Thumbnail Offset                : 31484
Create Date                     : 2024:01:28 10:28:23.57+01:00
Date/Time Original              : 2024:01:28 10:28:23.57+01:00
Modify Date                     : 2024:01:28 10:28:23.57+01:00

6. Which software versions do you use?

Build 231128-f48ff16ef

Originally created by @martyone on GitHub (Jan 31, 2024). #### 1. What is not working as documented? In the Search view, with Newest First order. A photo and a video taken shortly one after the other appear in wrong order. This happens when the recording device uses time zone other than UTC. In such case the time recorded in video metadata is UTC (standard behavior IIUC) while the time recorded in photo metadata may be local time with time zone information. As mentioned here https://github.com/photoprism/photoprism/issues/2265#issuecomment-1101712272 PhotoPrism seems to sort them based on the "local time", i.e., ignoring the time offset, which seems to explain what I see. #### 2. How can we reproduce it? Steps to reproduce the behavior: 1. Record a photo, then a video and another photo at last with a camera with time zone other than UTC set. 2. Import them in PhotoPrism 3. Go to the search view, Newest First 4. The video appears before or after the photos depending on the time zone offset (positive or negative) #### 3. What behavior do you expect? The video appears between the two photos, exactly in the order they were taken in. #### 4. What could be the cause of your problem? As mentioned here https://github.com/photoprism/photoprism/issues/2265#issuecomment-1101712272 PhotoPrism seems to sort them based on the "local time", i.e., ignoring the time offset. #### 5. Can you provide us with example files for testing, error logs, or screenshots? These three files are displayed in wrong order by PhotoPrism - the video appears after the photos with the Newest First ordering. ``` ~ $ exiftool DSC_1892.JPG|grep -e Date -e Offset File Modification Date/Time : 2024:01:28 10:24:47+01:00 File Access Date/Time : 2024:01:31 17:28:44+01:00 File Inode Change Date/Time : 2024:01:31 17:28:43+01:00 Modify Date : 2024:01:28 10:24:47 Date/Time Original : 2024:01:28 10:24:47 Create Date : 2024:01:28 10:24:47 Offset Time : +01:00 Offset Time Original : +01:00 Offset Time Digitized : +01:00 Date Display Format : D/M/Y Number Offsets : 31 Thumbnail Offset : 31484 Create Date : 2024:01:28 10:24:47.83+01:00 Date/Time Original : 2024:01:28 10:24:47.83+01:00 Modify Date : 2024:01:28 10:24:47.83+01:00 ~ $ exiftool DSC_1893.mp4|grep -e Date -e Offset File Modification Date/Time : 2024:01:28 10:25:38+01:00 File Access Date/Time : 2024:01:31 17:28:45+01:00 File Inode Change Date/Time : 2024:01:31 17:28:43+01:00 Media Data Offset : 48 Create Date : 2024:01:28 09:25:38 Modify Date : 2024:01:28 09:25:38 Track Create Date : 2024:01:28 09:25:38 Track Modify Date : 2024:01:28 09:25:38 Media Create Date : 2024:01:28 09:25:38 Media Modify Date : 2024:01:28 09:25:38 ~ $ exiftool DSC_1898.JPG|grep -e Date -e Offset File Modification Date/Time : 2024:01:28 10:28:23+01:00 File Access Date/Time : 2024:01:31 17:28:45+01:00 File Inode Change Date/Time : 2024:01:31 17:28:43+01:00 Modify Date : 2024:01:28 10:28:23 Date/Time Original : 2024:01:28 10:28:23 Create Date : 2024:01:28 10:28:23 Offset Time : +01:00 Offset Time Original : +01:00 Offset Time Digitized : +01:00 Date Display Format : D/M/Y Number Offsets : 31 Thumbnail Offset : 31484 Create Date : 2024:01:28 10:28:23.57+01:00 Date/Time Original : 2024:01:28 10:28:23.57+01:00 Modify Date : 2024:01:28 10:28:23.57+01:00 ``` #### 6. Which software versions do you use? Build 231128-f48ff16ef
Author
Owner

@lastzero commented on GitHub (Jan 31, 2024):

See the following discussion:

@lastzero commented on GitHub (Jan 31, 2024): See the following discussion: - https://github.com/photoprism/photoprism/discussions/3780#discussioncomment-7351364
Author
Owner

@lastzero commented on GitHub (Feb 26, 2024):

@martyone Based on the discussion linked above, this is the intended behavior right now and the only solution would be adding yet another config option (and possibly changing the database indexes and/or queries) so you can choose which behavior you prefer.

You are welcome to share any additional thoughts and/or ideas that you feel have not been discussed yet! 💭

@lastzero commented on GitHub (Feb 26, 2024): @martyone Based on the discussion linked above, this is the intended behavior right now and the only solution would be adding yet another config option (and possibly changing the database indexes and/or queries) so you can choose which behavior you prefer. You are welcome to share any additional thoughts and/or ideas that you feel have not been discussed yet! 💭
Author
Owner

@ggrzeczkowicz commented on GitHub (Aug 17, 2024):

I recently traveled near the UTC+12 and UTC-12 time zones. Their ordering by local time is very inconsistent, as a photo can have the same local date/time and actually have been taken a day apart.
So I think the UTC order is very important.

@ggrzeczkowicz commented on GitHub (Aug 17, 2024): I recently traveled near the UTC+12 and UTC-12 time zones. Their ordering by local time is very inconsistent, as a photo can have the same local date/time and actually have been taken a day apart. So I think the UTC order is very important.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#2027
No description provided.