angular.module("umbraco.filters").filter("myFilter", function () {
return function (input) {
// Apply any custom logic to modify the output value and return a string
return moment(input).format('DD. MM. yyyy');
}
});
I have moved on to umbraco 14 which doesn't use AngularJs but which suffers from restricting block labels.
I think that I will be able to do what I need there using a custom UFM component, though it is so convoluted it is hardly worth the effort. I wish there were more built-in UFM label formatting options.
How to format dates in blocklist labels
Hi to all, In Umbraco v8 I created a blocklist for events.
I would to show (as label) the title and date of a single event.
Title is ok, but the date not.
I set the "Label" field as follow:
The result, in content node, is:
But I expected it to be:
Can anyone help me to correctly format the label?
Thank you
Adriano
Hi Adriano,
That should be correct according to the angularJs docs : https://docs.angularjs.org/api/ng/filter/date
What do you get if you remove the date filter ? Maybe the date property is not a date but a formatted string already.
Dave
The date is an Umbraco DatePicker.
Yeah, I saw the the angularJs docs before set the filter: https://docs.angularjs.org/api/ng/filter/date
If I remove the date filter, I have the same result:
So...the filter don't function properly, but I don't know why.
Adriano
Hi Adrian,
It probably does noet work because the date field is not a javascript date object, but a formatted string.
So maybe you can try this :
Thank you but unfortunately your code return an empty value:
Adriano
Did you ever find a solution to this?
Hi, sorry for delay.
Unfortunately I haven't found a solution yet
https://our.umbraco.com/forum/using-umbraco-and-getting-started/100308-nested-content-template
This is a good news...I'll try this solution
Thank you Adriano
Hi please look at here https://docs.angularjs.org/api/ng/filter/date. You must try this steps.
I am having the same troubles. Anybody have any other suggestions?
outputs
"2024-03-13 00:00:00"
outputs "2024-03-13 00:00:00"
outputs ""
throws an exception
Hi,
use this instructions
https://docs.umbraco.com/umbraco-cms/13.latest/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/label-property-configuration
and for js part insert this
in BlockList editor insert
{{ eventDate | myFilter }}
Regards
Thanks Asembli,
I have moved on to umbraco 14 which doesn't use AngularJs but which suffers from restricting block labels.
I think that I will be able to do what I need there using a custom UFM component, though it is so convoluted it is hardly worth the effort. I wish there were more built-in UFM label formatting options.
https://docs.umbraco.com/umbraco-cms/reference/umbraco-flavored-markdown
is working on a reply...