graphene-sqlalchemy
graphene-sqlalchemy copied to clipboard
Formatting datetime-like columns
It'd be nice to be able to specify a strftime string which would automatically be used when resolving datetime-like columns so the user gets a friendly value.
Please provide an example of what the API would look like.
Probably using the Meta options:
class Book(SQLAlchemyObjectType):
class Meta:
model = models.Book
time_format = '%a, %d %b %Y %H:%M:%S'
Sounds helpful! However, I don't think a Meta entry would be the right place for this since some models might require different time formats in the same response.
The approach should allow field-level adjustments, but an additional default global option is also handy. I'm open to more suggestions.
However, I think this is rather low-priority since formatting is usually a front-end task and the current ISO8601 date strings enable all of that.
Closing this as part of triage, since this is an issue that is easily solvable in the frontend, as mentioned above. Please open a new issue with detailed examples, if you need this feature.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.