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.
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")
}
}
Great point, see also #91.
I know, I created https://github.com/graphcool/feature-requests/issues/240 before, so just taking the opportunity to make that point again :+1:
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.
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.
Most helpful comment
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.