cuba-platform / documentation

CUBA Platform Documentation
https://www.cuba-platform.com
Creative Commons Attribution 4.0 International
26 stars 45 forks source link

Improve 3.2.2.3.1. Datatype Format Strings page #639

Closed alexbudarov closed 4 years ago

alexbudarov commented 4 years ago

Environment

Description of the bug or enhancement

That page doesn't help much, unless you have seen default values and are familiar with NumberFormat / SimpleDateFormat Java SE classes.

Studio UI also doesn't help much (yet).

My suggestions: 1) Add links to Java SE documentation: DecimalFormat - https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html SimpleDateFormat - https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html

2) Add real examples with comments. Maybe even provide default values built-in into CUBA. A few examples from me:

# comma as decimal separator
numberDecimalSeparator=,

# space as thousands grouping separator
numberGroupingSeparator = \u0020

# Always display two digits after decimal separator, e.g. for currencies
decimalFormat = #,##0.00

# disable thousands grouping separator for integers
integerFormat = #0

# United States date format
dateFormat = MM/dd/yyyy

# Russia date+time format
dateTimeFormat = dd.MM.yyyy HH:mm

# alternative displaying for boolean values
trueString = yes
falseString = no
oshiryaeva commented 4 years ago

@alexbudarov please take a look at the commit above

alexbudarov commented 4 years ago

@oshiryaeva good, but we should not suggest this as example:

timeFormat=h:mm a

It will break TimeField components, they don't support such format. see https://github.com/cuba-platform/cuba/issues/2347

So it happens that timeFormat in CUBA is not customizable at all, you can't add seconds or am/pm part there.