Does anyone know of a possibility to format a tagged field, which holds for example a date?
We’re busy using labels were the textproperty is like: %%i18n:lbl.invoice_date%%: %%date_invoice%%
This results in ‘invoice date: 8-3-1 0:00’, which makes sense from a technical point of view, but doesn’t look to great…
Thnkx for any input!
What if you set the default format on the field itself?
it’s a label, which doesn’t have this property ![Sad :(]()
Sorry I was referring to set the default format to the database field itself:
[attachment=0]DefaultFormat.gif[/attachment]
Thnkx for your input Patrick! Unfortunately this doesn’t help…
besides that we should have an i18n entry do that job as we’re deploying a cross country/language SaaS solution…
I have tried to embed the format inside the tag like this:
%%i18n:lbl.invoice_date%%: %%date_invoice|yyyy-MM-dd%%
But it is not working. It would be nice though, a feature request to submit perhaps?
In the end, the only way I found was using a calc (not stored), which sends back a formatted text, like this:
function clc_order_date()
{
return utils.dateFormat(order_date, "yyyy-MM-dd");
}
And then use this calc instead of the field:
%%i18n:lbl.invoice_date%%: %%clc_order_date%%
This works.
Hope this helps,
Thnkx for your input Patrick!
This is what I was thinking of as a workaround, but don’t really want to use as I will end up with lots of calcs for different dates.
We actually want to use this for printouts, so we end up using labels moving towards eachother which works fine without the need for calcs.
I see.
So I think that the syntax %%date_invoice|yyyy-MM-dd%% would be the best.
You should try a feature request.
For a label the default format is used as specified on admin pages or smartclient preferences, for custom formatted (date)text on a label use a calc.
Jan Blok:
For a label the default format is used as specified on admin pages
Jan, where does SaaS with different countrysettings fit in this solution?
If you’d sent out an invoice in the US the date format should be different from invoices you sent out in the Netherlands.
As explained earlier in this thread the only way to do this is create calculations, which is something I’m trying to avoid as much as possible.
First of all to avoid unwanted firing of the code of these calculations, but even more because we’ve to deal with quite a number of different datefields…
For customer/SAAS specific use: i18n.setI18NMessage(‘locale.dateformat’, ‘myCustomerSpecificSAASDateFormat’)
in for example the solution startup method or during login