LocalisationListener
DateFormatter class uses a pattern formated String to render date and
time from a Date object.
If no pattern is defined, use pattern "DD/MM/YYYY" by default.
Pattern can be defined with many terms, pre-defined are :
Localisation API Localisation API Localisation API Localisation APIYou can add or override pattern parsing method using addType method.
Example
var f : DateFormatter = new DateFormatter(); f.formatString = "EE DD MMMM YYYY - HH:NN:SS"; var s : String = f.format( new Date() );
new DateFormatter()public formatString:StringUsually, formatting pattern is auto defined using
Localisation loaded.
If you set the pattern using this setter, formatter no longer listen
to localisation change.
Call connectToLocalisation() method to reconnect formatter to localisation API.
public function addType(type:String, scope, f:Function):VoidDefines custom formatting method for specific token.
type | Token to search for |
scope | Context of f method
|
f | Formatting method |
public function format(value:Date):String
Formats and returns passed-in value.
Formatted String
public function onLocalisationUpdate(event:LocalisationEvent):VoidTriggered when Localisation language change.
onLocalisationUpdate() in fever.app.local.LocalisationListener
public function connectToLocalisation():Void
Adds current formatter as Localisation listener.
Thus formatting pattern is autoupdate with current used lang.