Copied to clipboard

Flag this post as spam?

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


  • Hasheem Maloo 7 posts 29 karma points
    Nov 20, 2012 @ 16:34
    Hasheem Maloo
    0

    An error occurred during a call to extension function 'DateDiff'.

    Just upgraded from 4.90 to 4.10.1 and umbraco.library:DateDiff stopped working.

    <xsl:variable name="diffSeconds" select="umbraco.library:DateDiff('20-11-2012','05-11-2012', 's')" />

    My options are to use javascript (not ideal) or to rewrite this XSLT in Razor. Any XSLT related help would be appreciated.   

    Also tried to access the XSLT library page to see if there were any changes, but its now a 403 forbidden link... http://our.umbraco.org/documentation/Reference/Api/Umbraco.Library/

     

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Nov 20, 2012 @ 20:57
    Chriztian Steinmeier
    0

    Hi Hasheem - welcome to the forum!

    It looks like the dates in your example are backwards - you need the 'year' part first, then the month and lastly the date. More so, the second date is ambiguous, because even if the receiving function is able to figure out the year, it still wouldn't be able to tell if you meant "November 5th" or "May 11th".

    Based on how you wrote the first date, this should work:

    <xsl.variable name="diffSeconds" select="umbraco.library:DateDiff('2012-11-20', '2012-11-05', 's')" />

    /Chriztian

  • Hasheem Maloo 7 posts 29 karma points
    Nov 20, 2012 @ 23:17
    Hasheem Maloo
    0

    Thanks Chriztian!

    This is my actual source and it now works:  

    <xsl:variable name="diffSeconds" select="umbraco.library:DateDiff(umbraco.library:FormatDateTime(umbraco.library:CurrentDate(),'yyy-MM-dd'),umbraco.library:FormatDateTime(@createDate, 'yyy-MM-dd'), 's')" /> 

     Weird that it worked with the date format the wrong way round on v 4.7 -> 4.9!

Please Sign in or register to post replies

Write your reply to:

Draft