- Issue created by @soaratul
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Here the hardcoded date format ('d MMM') is working fine but it's better that the date formatting should align with Drupalโs standards to maintain consistency across the platform.
There is no one standard.
I bet you're referring to
core/modules/system/config/install/core.date_format.short.yml
and othercore.date_format.*.yml
files in that directory.The challenges in switching to one of those would be:
- Ensuring the patterns that PHP support are also supported on the client-side.
- What if the chosen
DateFormat
config entity is deleted? โ mitigated by using a lockedDateFormat
, which\Drupal\system\DateFormatAccessControlHandler
disallows being deleted. Not a perfect guarantee, but probably good enough. โ - Bikeshedding which
DateFormat
config entity the XB UI would use ๐
For point 2: safer/better still would be to make XB depend on that
DateFormat
config entity, but that'd require aXbUiConfig
config entity or something like that, which would declare various config dependencies on behalf of XB. But โฆ perhaps that'd actually be a good thing? There are likely more needs like this! That'd even allow a single central "XB configuration" UI (in an optional submodule? or contrib module?) for these kinds of settings.Asking @lauriii for feedback for that last paragraph :)
- ๐ซ๐ฎFinland lauriii Finland
Ensuring the patterns that PHP support are also supported on the client-side.
Would it be a bad idea to process the date formatting in PHP and send the client both the formatted date and timestamp?
What if the chosen DateFormat config entity is deleted? โ mitigated by using a locked DateFormat, which \Drupal\system\DateFormatAccessControlHandler disallows being deleted. Not a perfect guarantee, but probably good enough. โ
I don't think locked date formats provide the right capabilities. Besides preventing deletion, locking prevents changing the date format and translating the date format. Especially latter is something that is pretty unfortunate, because there isn't a standard international time format. Because of this, maybe the config dependency approach would work better for us?
Bikeshedding which DateFormat config entity the XB UI would use ๐
The designs are currently using "M j" as the date format. We should at least start with that.