gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API, OPDS and Kobo Sync support
https://komga.org
MIT License
3.85k stars 232 forks source link

Book `fileLastModified` reports UTC timestamps, but values are actually localized #1430

Closed farahnur42 closed 6 months ago

farahnur42 commented 6 months ago

Steps to reproduce

  1. Add a newly grabbed/created/modified book to any series

  2. Check fileLastModified for that book from the API response (with e.g. /api/v1/books/{bookId})

    {
    "id": "0F58NY1Z9D205",
    "seriesId": "0CJ42PH9819KV",
    "seriesTitle": "The Pension Life Vampire",
    "libraryId": "04CQ0DEQJ2E78",
    "name": "The Pension Life Vampire c022 (2024) (Digital)",
    "url": "/manga/The Pension Life Vampire/The Pension Life Vampire c022 (2024) (Digital).cbz",
    "number": 27,
    "created": "2024-02-16T16:28:12Z",
    "lastModified": "2024-02-16T16:29:27Z",
    "fileLastModified": "2024-02-16T11:42:32Z", ## should be 2024-02-16T05:42:32Z
    "sizeBytes": 14802017,
    "size": "14.1 MiB",
    "media": {
    "status": "READY",
    "mediaType": "application/zip",
    "pagesCount": 20,
    "comment": "",
    "epubDivinaCompatible": false,
    "mediaProfile": "DIVINA"
    },
    "metadata": {
    "title": "The Pension Life Vampire c022 (2024) (Digital)",
    "titleLock": false,
    "summary": "",
    "summaryLock": false,
    "number": "22",
    "numberLock": true,
    "numberSort": 22,
    "numberSortLock": true,
    "releaseDate": null,
    "releaseDateLock": false,
    "authors": [
      {
        "name": "Shouichi Taguchi",
        "role": "penciller"
      },
      {
        "name": "Shouichi Taguchi",
        "role": "inker"
      },
      {
        "name": "Shouichi Taguchi",
        "role": "colorist"
      },
      {
        "name": "Shouichi Taguchi",
        "role": "letterer"
      },
      {
        "name": "Shouichi Taguchi",
        "role": "cover"
      },
      {
        "name": "Shouichi Taguchi",
        "role": "writer"
      }
    ],
    "authorsLock": false,
    "tags": [],
    "tagsLock": false,
    "isbn": "",
    "isbnLock": false,
    "links": [],
    "linksLock": false,
    "created": "2024-02-16T16:28:12Z",
    "lastModified": "2024-02-16T16:34:28Z"
    },
    "readProgress": null,
    "deleted": false,
    "fileHash": "6748aa089dd44956a83397d06ffaf1f8",
    "oneshot": false
    }
  3. Notice that the time is localized, not in UTC. image

Expected behavior

The time should be converted to UTC from whatever the configured timezone is, as the API reports it as UTC.

Actual behavior

The time is localized so it can be either in the future or the past depending on your native timezone (in my case perpetually 6h in the future).

Logs

No response

Komga version

1.10.3-master

Operating system

Docker

Installation method

Docker

Other details

This throws off the date/time for recently added content on e.g. the Tachiyomi Komga extension <=1.4.55 (1.4.55 switches from fileLastModified to lastModified which is even more incorrect as any metadata change, reordering etc to the book will throw it off - I've asked for this behaviour to be reverted once the timestamps are fixed Komga-side).

Acknowledgements

gotson commented 6 months ago

can you provide details of your filesystem time for that file ?

farahnur42 commented 6 months ago

This throws off the date/time for recently added content on e.g. the Tachiyomi Komga extension <=1.4.55 (1.4.55 switches from fileLastModified to lastModified which is even more incorrect as any metadata change, reordering etc to the book will throw it off - I've asked for this behaviour to be reverted once the timestamps are fixed Komga-side).

Update on this for anyone stumbling upon this issue: 1.4.56 switches over to book.created instead of book.LastModified, and it can be switched back over to fileLastModified in the future.

github-actions[bot] commented 6 months ago

🎉 This issue has been resolved in 1.10.4 (Release Notes)