accessor for the date field #1419
Replies: 1 comment
-
|
Backpack already handles date formatting for you in the ListOperation (the admin panel backend) using Carbon, and you do not need to override the accessor in your model to achieve a localized or formatted date display in the admin panel. In fact, overriding the accessor to return a formatted string (like How Backpack handles date formatting:
What you should do:
For your frontend (outside Backpack):
Summary: For more details, see the official documentation: date column, datetime column. ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: date field initializations should not rely on wrapper class |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Do you have something like Carbon integrated in backpack?
Because when I try to add accessor for the
datefield it works well in my frontend, but backend ListOperation I got errorProblem appears only when I add following accessor im my model.
But if I don't add it I have not beautiful date output in frontend like this
2026-07-22 00:00:00instead of17 сентября 2026.I see that in backend date looks well, but I can't understand how it
So I want to know if you have some other method integrated in backpack, which I can use to output the date in frontend.
Beta Was this translation helpful? Give feedback.
All reactions