Implem / Implem.Pleasanter

Pleasanter is a no-code/low-code development platform that runs on .NET. You can quickly create business applications with simple operations.
https://pleasanter.org
GNU Affero General Public License v3.0
511 stars 81 forks source link

API エンドポイント毎に日付書式が異なる #529

Open jaizawa758 opened 3 months ago

jaizawa758 commented 3 months ago

Pleasanter バージョン1.4.2.1

通常のアイテムと添付ファイルを取得するAPIの日付書式が異なります。

{
    "CreatedTime": "2024-03-22T11:26:22",
    "UpdatedTime": "2024-03-27T14:36:55",
}
{
    "CreatedTime": "2024/03/27 14:36:53",
    "UpdatedTime": "2024/03/27 14:36:53"
}
pierre3 commented 2 months ago

Issueありがとうございます。 確認いたしますのでお待ちいただけますでしょうか。

narita1980 commented 1 month ago

こちら現状のクラウド環境にて確認しました。

curl --location 'https://pleasanter.net/fs/api/items/11668683/get' \
--header 'Content-Type: application/json' \
--data "{
     \"ApiVersion\": 1.1,
     \"ApiKey\": \"${APIKEY}\"
}" | jq | grep -e CreatedTime -e UpdatedTime
---
        "UpdatedTime": "2024-05-28T01:03:01",
        "CreatedTime": "2024-05-28T01:03:01",
        "UpdatedTime": "2024-05-24T12:51:06",
        "CreatedTime": "2024-05-17T01:08:04",
        "UpdatedTime": "2024-05-16T12:52:07",
        "CreatedTime": "2024-05-16T12:52:07",
curl --location 'https://pleasanter.net/fs/api/binaries/AF8EFED921FB46B9B61B98C7F7DAC74C/get' \
--header 'Content-Type: application/json' \
--data "{
     \"ApiVersion\": 1.1,
     \"ApiKey\": \"${APIKEY}\"
}" | jq | grep -e CreatedTime -e UpdatedTime
---
    "CreatedTime": "5/27/2024 4:03:01 PM",
    "UpdatedTime": "5/27/2024 4:03:01 PM"
narita1980 commented 1 month ago

原因として、通常のアイテム取得の日付生成ロジックは以下のようにToDateTimeメソッドを使ってますが、

https://github.com/Implem/Implem.Pleasanter/blob/54e255d8c8a410c85c6e2ccc2b1fff525bc7dbed/Implem.Pleasanter/Models/Items/ItemModel.cs#L3415

添付ファイルを取得するAPIは、該当箇所でデータベースから直接取得しているため生成ロジックが異なることが原因かと思われます。 https://github.com/Implem/Implem.Pleasanter/blob/54e255d8c8a410c85c6e2ccc2b1fff525bc7dbed/Implem.Pleasanter/Libraries/Responses/FileContentResults.cs#L144