default locale change, version 5.0.1 -> 5.1 - qooxdoo

(sorry my english) Hi.
With 5.0.1, the default short date format for locale "es" (in config.json) return this date format "10/01/2017"
With 5.1, the default short date format for locale "es" (in config.json) return this date format "10 ene. 2017".
I think is a coherent change. But I need keep working with the old format. So, where I must touch to get the old format in a entire new 5.1 qooxdoo project?
I mean, where this locale format is defined? I was trying found where but I can't.
Or any other solution.
thanks

This snippet works for us
this._localeManager = qx.locale.Manager.getInstance();
this._localeManager.addLocale("el", {
"cldr_date_format_short": "dd/MM/yyyy" // Override short date format for Greek
});

Related

Calendar locale (German) for PlantUML gantt diagrams

Can someone tell me, how I can define another calendar's locale (e.g. German) for the rendered calendar parts of the nice gantt feature in plantUML
I have something like:
#startgantt
-- Vorbereitung --
Project starts 2020-12-01
[Themenfindung] starts 2020-12-01 and ends 2021-01-01
[milestone] happens at 2020-12-15
-- ... --
#endgantt
The output prints month and daynames in English:
Is it possible at all and if so how can this be changed to German.
There is nothing about this in the documentation (https://plantuml.com/de/gantt-diagram).
With last beta http://beta.plantuml.net/plantuml.jar you can now specify a language for the Calendar.
For example:
#startgantt
Language DE
Project starts the 20th of september 2017
...
#endgantt
This will be integrated in next official release.
According to their source code,
there are hardcoded values for days and months as Enums
and they use name() method to get their English names.
I would recommend you to clone their repo and change the hardcoded values in two classes:
In file src/net/sourceforge/plantuml/project/time/DayOfWeek.java
replace method shortName like this:
public String shortName() {
Locale locale = Locale.getDefault();
String s = StringUtils.capitalize(java.time.DayOfWeek.valueOf(this.toString()).getDisplayName(TextStyle.SHORT_STANDALONE, locale));
return s.substring(0,2);
}
In file src/net/sourceforge/plantuml/project/time/Month.java
replace two methods like this
public String shortName() {
return StringUtils.capitalize(java.time.Month.valueOf(this.toString()).getDisplayName(TextStyle.SHORT_STANDALONE,Locale.getDefault()));
}
and
public String longName() {
return StringUtils.capitalize(java.time.Month.valueOf(this.toString()).getDisplayName(TextStyle.FULL_STANDALONE,Locale.getDefault()));
}
I compile only these two classes and replace them in jar file. This works for me.
Mike.

Orckestra C1: Can a Date formatter be applied to a Tree Definition DataElement Label attribute?

I know for a Tree Definition of DataElementFolder, there is a DateFormat attribute, but the DataElement node doesn't have such an attribute.
<DataElements Type="MA.PressRelease.Article" Label="${C1:Data:MA.PressRelease.Article:Date}" Display="Auto">
This will show up looking like this.
It would be nice to have something like "Month day, Year" (Ex: May 4, 2017)
https://github.com/Orckestra/C1-CMS-Foundation/issues, open a new issue, starting with the Title "Feature Request:" make a clear explanation about the benefits and anything else that you think that would improve and wait for response.
No, as of the latest release the date format is hard-coded:
https://github.com/Orckestra/C1-CMS-Foundation/blob/dev/Composite/C1Console/Trees/DataFieldValueHelper.cs#L65
Per version 6.2 of C1 CMS you can control the label format for fields of type DateTime, decimal and int - thanks to your feature request.
Usage: Append a colon and then a format string to your label directive, for example:
<DataElements Type="MA.PressRelease.Article" Label="${C1:Data:MA.PressRelease.Article:Date:MMM d, yyyy}" Display="Auto">
The format string is the same you would use with .ToString() for the type of the field, ex "MMM d, yyyy" for dates, "F1" or "C" for decimals and ints.

Angular date filter: Format month as local time

I have a date formatted as a ISO-8601 string: overview.startTime = "2017-05-09T08:00:00Z"
I want to display this on my page and I have used the following code:
Dagens arbetspass {{overview.startTime | date:'dd-MMM'}}
This is displayed as "Dagens arbetspass 09-May". My problem is that this is a Swedish site, and in Sweden we don't start the month names with an uppercase character. Also May is written "maj" (j in the end and not y). I tried to add the timezone like this
Dagens arbetspass {{overview.startTime | date:'dd-MMM':'Europe/Stockholm'}}
but that did not change the output. In fact, most months are spelled differently in Swedish. Any suggestions?
Just use the javascript "toLocaleDateString" method to resolve the concern. The method takes two arguments which are 'locale' and 'options'.
Locale will be "sv-se" for swedish.
Options will provide the format to your string. For example -var options = { weekday: "long", year: "numeric", month:long",day:"numeric" };
var d = new Date("2017-05-09T08:00:00Z");
date.toLocaleDateString("sv-se", options)
Here's a plunker https://plnkr.co/edit/G2IL5Zv0OAcVRMZS9HB7

'date' filter without time zone in angularjs

This is input format:
yyyy:MM:dd'T'HH:mm:ss'Z' (Coming as a string from json service)
Required output format:
dd-mmm-yyyy
I have tried with {{txnDate | date:'dd-mm-yyyy'}}
but it is not working..
What is the format you are following for your date?
A quick var a = new Date(); a.toISOString(); in console will give you something like "2015-02-19T13:30:13.347Z". The formatted string you are receiving is not following any standard and I am afraid parsing it to date will result in Invalid Date in most of the browsers.
So you can either
Get your Date in proper format.
Make the best use of whatever is available. You can use split to break your string into individual components.
Something like:
var a = "yyyy:MM:dd'T'HH:mm:ss'Z'" //Replace with actual string
b=a.split(':') will result in ["yyyy", "MM", "dd'T'HH", "mm", "ss'Z'"] giving you year and months in b[0] and b[1].
For date, you can use b[2].substring(0,2) to give you dd.
You have all date components(apart from time components, which you don't need anyway) as string.
Either use them directly(as a string) or make a date object using these components(since you want month in MMM format).
$scope.txnDate = new Date(b[0]+'/'+b[1]+'/'+b[2].substring(0,2));
I am sure there are more ways to optimize this. Comment if this doesn't work for you, will try to elaborate more.

cakephp 3 displaying date without time

CakePHP 3: I have a database field which is a DATE (not DATETIME nor TIMESTAMP)
When I display
echo $contact->date;
It will show something like 2014. 01. 06. 0:00. How to hide hours and minutes?
I tried
print $this->Time->format($contact->date, 'Y-m-d');
but I got 2014-0-6
How to get year-month-day?
rrd
Have you tried this?
echo $contact->date->format('Y-m-d');
add in App\Controller:
use Cake\I18n\Time;
Time::$defaultLocale = 'es-ES';
Time::setToStringFormat('YYYY-MM-dd');
You can directly print the date object in any custom date String format by using the inbuilt i18nFormat function.
$frozenDateObj->i18nFormat('dd-MMM-yyyy');
Use Datetime Format Syntax reference for more customization
If need all over the project with specific format you can use
boostrap.php
Cake\I18n\FrozenDate::setToStringFormat('yyyy-MM-dd');
echo date_format($contact->date, 'Y-m-d'); //php format
try
date('Y-m-d',strtotime($contact->date));

Resources