In an XSLT file, I am calling a function to a javascript file (.ascx) and trying to pass parameters. One parameter is a Date() object. The only way I've found to successfully pass it is to pass it as a string.

Here's the code from the XSLT file.

<script>
      grouping("<xsl:value-of select ="Date1"/>", <xsl:value-of select ="ID"/>);
    </script>

Here's my function in Javascript.

function grouping(date, num) 
{
     // Date is now a string instead of a Date() object
}

What I want to do is keep the date object a date object and not a string. Anyone know how to do this? Otherwise, I'll have to parse the string and make a new Date out of the substrings.

In an XSLT file, I am calling a function to a javascript file (.ascx) and trying to pass parameters. One parameter is a Date() object. The only way I've found to successfully pass it is to pass it as a string.

Here's the code from the XSLT file.

<script>
      grouping("<xsl:value-of select ="Date1"/>", <xsl:value-of select ="ID"/>);
    </script>

Here's my function in Javascript.

function grouping(date, num) 
{
     // Date is now a string instead of a Date() object
}

What I want to do is keep the date object a date object and not a string. Anyone know how to do this? Otherwise, I'll have to parse the string and make a new Date out of the substrings.

Use Date function instead of a Date return Date() .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.