Automattic/o2

o2-timestamp doesn't support PHP escaped characters.

dd32 opened this issue · 0 comments

dd32 commented

As reported in https://meta.trac.wordpress.org/ticket/7056 o2 doesn't properly handle escaped characters in the date_format.

SCR-20230613-hjl

@dd32:
It seems this is coming from the date_format being set to j \d\e F \d\e Y (This is likely coming from a GlotPress translated string)

That's then escaped to "dateFormat":"j \\d\\e F \\d\\e Y" when output as part of o2 settings, and it's then converted over to Moment.js date format in https://github.com/Automattic/o2/blob/master/js/utils/timestamp.js

It looks like the above o2 code doesn't handle escaped characters.