[TIMOB-16378] TiAPI: Add Get default format methods to Global.String class
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | TiAPI |
Labels | n/a |
Reporter | Thomas Neerup |
Assignee | Unknown |
Created | 2014-02-03T12:29:36.000+0000 |
Updated | 2018-02-28T20:04:26.000+0000 |
Description
It would be very helpfull if String.Global could have methods to return the current date and timeformats. Somthing like:
getDateFormat('medium') -> 'MM/DD/YYYY'
getTimeFormat('medium') -> 'hh:mm'
getCurrencySymbol() -> $
This would be helpfull when you have a backend that provides titles and labels to your mobile app.
I am curious how would different applications would use this information in a consistent way. A date format may be suitable for an application but not another application. What may be a "medium" format may be "large" format for another application. I would think that it is application specific and should be handled at that level. What may be more relevant is to get the current date and time format for the current locale - getDateFormat() getTimeFormat() getCurrency() Would something like this work for your use case?
Hi Ritu. At this time the String.formatDate() can take small/medium/long as format and returns the different types of formatted dates.
So I thought i would be very relevant to have the parameter. Use case: My application calls the backend for data to display on the screen.. The backend returns the title for a window. The title should be something like *"From 03/02/2013 to 05/02/2013"* on a device with *da-DK* Locale, The backend needs the short date format to format the title. But if the title should be something like *"Sales for 3. Februar 2013"* The backend needs the medium date format to format the title. Does this clarify my request?
Moving this feature request to engineering for further evaluation and prioritization.