Use actual ISO8601 timestamps for masto API (#425)
authordarkkirb <lotte@chir.rs>
Mon, 9 Jan 2023 22:12:28 +0000 (22:12 +0000)
committerfloatingghost <hannah@coffee-and-dreams.uk>
Mon, 9 Jan 2023 22:12:28 +0000 (22:12 +0000)
commita8cd859ef930d968bebeb2afb373ed002e8824f7
tree10f7becb48a90a85d550d02d37fbbbfb2c7dba87
parent0d56adc16b0234744d569dd61d16322ef89589dc
Use actual ISO8601 timestamps for masto API (#425)

Some users post posts with spoofed timestamp, and some clients will have issues with certain dates. Tusky for example crashes if the date is any sooner than 1 BCE (“year zero” in the representation).

I limited the range of what is considered a valid date to be somewhere between the years 1583 and 9999 (inclusive).

The numbers have been chosen because:

- ISO 8601 only allows years before 1583 with “mutual agreement”
- Years after 9999 could cause issues with certain clients as well

Co-authored-by: Charlotte 🦝 Delenk <lotte@chir.rs>
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/425
Co-authored-by: darkkirb <lotte@chir.rs>
Co-committed-by: darkkirb <lotte@chir.rs>
lib/pleroma/web/common_api/utils.ex
test/pleroma/web/common_api/utils_test.exs