Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16378] TiAPI: Add Get default format methods to Global.String class

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsTiAPI
Labelsn/a
ReporterThomas Neerup
AssigneeUnknown
Created2014-02-03T12:29:36.000+0000
Updated2018-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.

Comments

  1. Ritu Agrawal 2014-02-04

    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?
  2. Thomas Neerup 2014-02-04

    Hi Ritu. At this time the String.formatDate() can take small/medium/long as format and returns the different types of formatted dates.
       String.formatDate( date, [format] ) : String
       
    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?
  3. Ritu Agrawal 2014-02-05

    Moving this feature request to engineering for further evaluation and prioritization.

JSON Source