You should be able to use a angular filter in the label, something like this
{{createDate | date:'yyyy-MM-dd HH:mm:ss Z'}}
Edit:
Or... maybe not. Some dates are returned as strings from the Umbraco APIs... then you would first have to convert the string to a JS-date and then format it... maybe could be done using momentjs..
Something like this
{{moment(createDate).format("MMM Do YY")}}
I’m not sure that this would work... and you might have to include momentsjs introt he backoffice using a package.manifest-file
So it only stores some data about the documentype, a key and the generic properties, not a standard property like "create date". Any way. As you can see the eventDate (or any date) is stored as a string formatted like in your screenshot.
I tested the example code that I was proposing and as you say it does not render anything, and it does not throw any errors.
{{moment(eventDate).format('YYYY')}}
And since the date is just a string, the standard filter in AngularJS will not work either.
{{eventDate | date:'yyyy-MM-dd HH:mm:ss Z'}}
I guess that if you really need to format the date you could try to create your own AngularJS filter that’s using MomentJs to first convert the string to a date and then formats the date from there. Maybe something like this:
You would then need to include this filter in a js-file that you reference in a package.manifest file to the the Umbraco backoffice to load your filter.
I do see that this is a complicated solution to a simple problem but there is no built in way to format the date as far as I know.
Format date of Nested Content list item
How can I change the date format for an item in a Nested Content list in the back office? By default it shows year first. I want dd/mm/yyyy.
You should be able to use a angular filter in the label, something like this
{{createDate | date:'yyyy-MM-dd HH:mm:ss Z'}}
Edit: Or... maybe not. Some dates are returned as strings from the Umbraco APIs... then you would first have to convert the string to a JS-date and then format it... maybe could be done using momentjs..
Something like this
{{moment(createDate).format("MMM Do YY")}}
I’m not sure that this would work... and you might have to include momentsjs introt he backoffice using a package.manifest-file
Yeah, by itself, that does not return anything. Seems like this ability should be out of the box.
Hi!
I just had a closer look at this since I created my example from my phone without access to any computer to test with.
First of all, Nested Content does not store the create date, it just stores a minimal amount of data for the created item
This is from the umbraco cache-file in the app_data folder:
So it only stores some data about the documentype, a key and the generic properties, not a standard property like "create date". Any way. As you can see the eventDate (or any date) is stored as a string formatted like in your screenshot.
I tested the example code that I was proposing and as you say it does not render anything, and it does not throw any errors.
And since the date is just a string, the standard filter in AngularJS will not work either.
I guess that if you really need to format the date you could try to create your own AngularJS filter that’s using MomentJs to first convert the string to a date and then formats the date from there. Maybe something like this:
https://gist.github.com/cmmartin/341b017194bac09ffa1a
You would then need to include this filter in a js-file that you reference in a package.manifest file to the the Umbraco backoffice to load your filter.
I do see that this is a complicated solution to a simple problem but there is no built in way to format the date as far as I know.
Hope you find your way around this!
I think Erik-Jan's answear at this page https://our.umbraco.com/forum/using-umbraco-and-getting-started/100308-nested-content-template solves this problem in Umbraco 8
{{dateUntill| momentDateTimeZone:"YYYY-MM-DD"}}
is working on a reply...