Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Add a pure date field type #273

Closed
marktani opened this issue Jun 25, 2017 · 5 comments
Closed

Add a pure date field type #273

marktani opened this issue Jun 25, 2017 · 5 comments
Labels
status/stale Marked as state by the GitHub stalebot

Comments

@marktani
Copy link
Contributor

You can use DateTime to store dates like this 2017-06-25, which will be converted to 2017-06-25T00:00.000Z. As an addition to this, storing pure date fields would be nice so you don't have to think about timezones when displaying it: 2017-06-25 won't be converted.

@kbrandwijk
Copy link
Contributor

kbrandwijk commented Jun 25, 2017

I think a better solution would be a field argument 'format'. A date is a date, stored as a date. Formatting requirements should not creep into the storage model.

query {
   allPosts {
      title
      createdAt(format: "yyyy-MM-dd")
   }
} 

@marktani
Copy link
Contributor Author

Great point, see also #91.

@kbrandwijk
Copy link
Contributor

I know, I created https://github.com/graphcool/feature-requests/issues/240 before, so just taking the opportunity to make that point again 👍

@rtoal
Copy link

rtoal commented Feb 6, 2018

Dates and datetimes are very different. A person wants to store their birthdate with the year, month, and day that they like, usually in the time zone in which they were born. DateTimes are instants. IT doesn't feel right to use a datetime for a birthdate field. Yeah it works if you "assume UTC and ignore H, M, S, and all the small fields...." Just feels dirty. A pure date time would be nice. In the meantime, storing year, month, and day works too. Dates and times are hard.

@stale
Copy link

stale bot commented Jan 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale Marked as state by the GitHub stalebot label Jan 9, 2019
@stale stale bot closed this as completed Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/stale Marked as state by the GitHub stalebot
Projects
None yet
Development

No branches or pull requests

4 participants