Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sam Marshallsay 35 posts 135 karma points
    May 24, 2021 @ 16:04
    Sam Marshallsay
    0

    Formatting date in List View Template?

    I've added the umbracoMemberLastLogin date as a column on a member. How can I format how this date appears to the user? I assume its using the template field, but I can't find any reference to the correct syntax.

    Thanks

  • Bjørn Nyborg 5 posts 73 karma points
    Aug 26, 2021 @ 07:48
    Bjørn Nyborg
    0

    Did you find a solution to this? Having the same problem. 😊

  • Gary 1 post 71 karma points
    Oct 21, 2022 @ 03:21
    Gary
    0

    Anyone has solution for this? Please help. 😊

  • suzyb 474 posts 932 karma points
    Feb 06, 2023 @ 20:38
    suzyb
    2

    For anyone else that comes across this thread when searching here is the template you need to use, replacing the formatting string with what you require.

    {{ value | momentDateTimeZone:"YYYY-MM-DD" }}
    
  • Karl Tynan 16 posts 151 karma points MVP 4x c-trib
    Feb 15, 2023 @ 11:31
    Karl Tynan
    0

    This was exactly what I was looking for! I'll try and find time to create a PR to the new docs so others are aware of how to format dates.

    Did you find out how to handle empty values (maybe a node doesn't implment the field, for example). I'd like to show something else conditionally if so.

  • Ian Campbell 6 posts 76 karma points
    Jan 15, 2024 @ 10:54
    Ian Campbell
    0

    This doesn't appear to be working in Umbraco v13. Does anyone know if there is a new way to format dates via the list view template field?

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Jan 18, 2024 @ 13:35
    Bjarne Fyrstenborg
    1

    Work to me as well in a project on Umbraco 12. However since the date isn't mandatory I modified the template:

    {{ value ? (value | momentDateTimeZone:"YYYY-MM-DD") : "" }}
    

    Otherwise one will get "Invalid date" at the items missing a date value.

Please Sign in or register to post replies

Write your reply to:

Draft