Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format datetime fields in API as ISO8601 #1011

Closed
timobrembeck opened this issue Nov 2, 2021 · 4 comments · Fixed by #1642
Closed

Format datetime fields in API as ISO8601 #1011

timobrembeck opened this issue Nov 2, 2021 · 4 comments · Fixed by #1642
Assignees
Labels
🔨 enhancement This improves an existing feature ❗ prio: medium Should be scheduled in the forseeable future. 😅 effort: medium Should be doable in <12h
Milestone

Comments

@timobrembeck
Copy link
Member

timobrembeck commented Nov 2, 2021

Motivation

When implementing the API, we replicated the WordPress API as similar as possible, including some weird date formats which are not ideal for processing them in the apps.

Proposed Solution

  • For every datetime field, add a new field to represent the same date in ISO_8601 format. This affects e.g.:
    • The start_date, start_time/ end_date, end_time fields of events - combine them into start/end
    • The sent_date field of push notifications
    • The modified_gmt field of all other objects (maybe also rename this to last_updated or last_modified)

Alternatives

Additional Context

@timobrembeck timobrembeck added ‼️ prio: high Needs to be resolved ASAP. 🔨 enhancement This improves an existing feature labels Nov 2, 2021
@timobrembeck timobrembeck added this to the Version 2.0 milestone Nov 2, 2021
@timobrembeck timobrembeck added the 🍼 good first issue Good for newcomers label Nov 2, 2021
@svenseeberg svenseeberg modified the milestones: Version 1.2, Version 1.3 Apr 27, 2022
@svenseeberg svenseeberg modified the milestones: 22Q3, 22Q4 Jun 7, 2022
@svenseeberg svenseeberg added ❗ prio: medium Should be scheduled in the forseeable future. 😅 effort: medium Should be doable in <12h and removed ‼️ prio: high Needs to be resolved ASAP. labels Jun 7, 2022
@steffenkleinle
Copy link
Member

steffenkleinle commented Jul 12, 2022

Could we perhaps move this a little bit up please? We still have to live with moment and the date formatting workaround :/ Only if it fits in though, not super urgent, the current state continues to work.

@svenseeberg svenseeberg modified the milestones: 22Q4, 22Q3 Jul 13, 2022
@svenseeberg
Copy link
Member

Should be possible, yes :)

@JanErikHuehne JanErikHuehne self-assigned this Aug 6, 2022
@JanErikHuehne
Copy link
Contributor

Is it correct, that the sent_date and modified_gmt have already been modified beforehand?

@timobrembeck
Copy link
Member Author

Is it correct, that the sent_date and modified_gmt have already been modified beforehand?

The modified_gmt field of pages & imprint is already correct, but e.g. the modified_gmt field of the event and location API reponse and the timestamp field of the push notification API are in the Y-m-d H:i:s format, but the desired format is YYYY-MM-DDTHH:MM:SS.fff - the representation of datetime.isoformat() (which is also the default string representation of a DateTimeField in Django, so just use the unformatted - but timezone aware - model field in the API response and Django will automatically format it correctly).

@JanErikHuehne JanErikHuehne linked a pull request Aug 21, 2022 that will close this issue
@timobrembeck timobrembeck removed the 🍼 good first issue Good for newcomers label Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 enhancement This improves an existing feature ❗ prio: medium Should be scheduled in the forseeable future. 😅 effort: medium Should be doable in <12h
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants