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

Support for AM/PM in DateTime variable formats #318

Closed
martinhalford opened this issue Sep 6, 2020 · 6 comments
Closed

Support for AM/PM in DateTime variable formats #318

martinhalford opened this issue Sep 6, 2020 · 6 comments

Comments

@martinhalford
Copy link
Member

martinhalford commented Sep 6, 2020

Is your feature request related to a problem? Please describe.
Currently, it is only possible to display DateTime variables in 24 Hr format (e.g. 15:00) whereas some end-users may expect to see times displayed in AM/PM format (e.g. 3:00 pm).

Describe the solution you'd like
Current DateTime format options are defined at https://docs.accordproject.org/docs/markup-variables.html

Would be great if DateTime variables supported the following additional format options:

t - The first character of the AM/PM designator. (Example: A or P)
tt - The AM/PM designator. (Example AM or PM)

Of course, if the t or tt format were to be used then the PM hour values would need to be displayed using their 12-hour values instead of their 24-hour values (e.g. 3:00 PM instead of 15:00 PM).

@jeromesimeon
Copy link
Member

jeromesimeon commented Sep 6, 2020

To stay aligned with moment.js we should probably use a A along with h hh if we want to support this. I'm curious about the single "A" or "P" I have never seen that used before.

Note that we do support 12-hours values from 1 to 12 with h and hh (despite what the documentation says).

@martinhalford
Copy link
Member Author

Hi @jeromesimeon, As an old .NET C# developer, t and tt were what we used for AM/PM designators. To be fair, I only ever used tt as, like you, I never saw A or P used anywhere. However, the language supported it (for whatever reason).

https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings#tSpecifier

Anyway...it was just a suggestion. If moment.js follows some other convention, then let's use that.

Having said that, there's no real point adding support for AM/PM unless we can add support for 12-hour values too. Users would not expect to see 15:00 PM, as that would be somewhat confusing.

Sounds like this is not an easy enhancement?

@jeromesimeon
Copy link
Member

jeromesimeon added a commit to jeromesimeon/markdown-transform that referenced this issue Sep 10, 2020
jeromesimeon added a commit that referenced this issue Sep 10, 2020
…318

Signed-off-by: Jerome Simeon <jeromesimeon@me.com>
@jeromesimeon
Copy link
Member

Added in #319

Semantics notes:

  • 12:14am on a Tuesday is 00:14 on that Tuesday
  • 12:00am on a Tuesday is 00:00 on that Tuesday
  • 12:00pm on a Tuesday is 12:00 (noon) on that Tuesday

@jeromesimeon
Copy link
Member

jeromesimeon commented Sep 15, 2020

Released in https://github.com/accordproject/cicero/releases/tag/v0.21.7 Let me know if it works.

@martinhalford
Copy link
Member Author

@jeromesimeon - We are using this new AM/PM format in our real estate contract templates now. Works like a charm! Thank you!!

image

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

No branches or pull requests

2 participants