Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromMillis not handling PN picture string #574

Closed
alexwoodgate opened this issue May 6, 2022 · 1 comment · Fixed by #644
Closed

fromMillis not handling PN picture string #574

alexwoodgate opened this issue May 6, 2022 · 1 comment · Fixed by #644
Labels

Comments

@alexwoodgate
Copy link

I'm trying to format a timestamp with the AM/PM marker in uppercase with $fromMillis(). Looking at the JSONata doc https://docs.jsonata.org/date-time-functions#frommillis which points to https://www.w3.org/TR/xpath-functions-31/#date-picture-string I can see some examples with [PN] for upper case (3:58 PM format-time($t, "[h]:[m01] [PN]", "en", (), ()) ) and [Pn] for lower case (3:58:45 pm format-time($t, "[h]:[m01]:[s01] [Pn]", "en", (), ()).

I've tried out some equivalent picture values on https://try.jsonata.org/ with:
$fromMillis($millis(), "[h]:[m01] [Pn]") which also returns "10:17 am" (Correct)
$fromMillis($millis(), "[h]:[m01] [PN]") which returns "10:17 am" (I believe this is incorrect and should be "10:17 AM")

I've been able to work around this with $uppercase() so it's a minor issue but I wanted to raise here to confirm whether the behaviour is incorrect for [PN] or if I'm misunderstanding how this should work. Thanks.

@bennyb0i
Copy link

Any luck with this issue? I've run into a very similar case trying to format a timestamp using $fromMillis() as well.

My JSONata excerpt: $fromMillis($toMillis($split(payload.timestamp,' ')[1], '[H01]:[m01]:[s01]'),'[h]:[m01][PN]'); also returns am/pm, instead of AM/PM as it apparently should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants