I'm planning on updating the package with a slightly different approach for the start- and enddates which will then also include times.
Perhaphs you can add a few properties of your own which contain the start and end times? I don't know how you plan to use it, but could be worth trying.
I am trying to list events only in the future in a simple list and have the xslt:
<xsl:for-each select="$newsPage/node[./data[@alias = 'event']/pdcalendarevent/pdcstart!='' and umbraco.library:DateGreaterThanOrEqualToday(umbraco.library:FormatDateTime(./data[@alias = 'event']/pdcalendarevent/pdcstart, 'dd/MM/yyyy'))]">
But it fails and says that:
String was not recognized as a valid DateTime.
String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at umbraco.library.DateGreaterThanOrEqualToday(String firstDate)
What format is the pdcstart and how would i format as datetime???
This is some of the code I used (keep in mind I made it such that different start & end dates could be specified, so you wouldn't need all of this, but you should get the idea:
<!--Get first and last dates for all events --> <xsl:variable name = "AllFirstDate"> <xsl:for-each select="$EventsNode/node [@nodeTypeAlias='Event']"> <xsl:sort select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcstart" order="ascending" data-type="text"/> <xsl:if test="position()=1"> <xsl:value-of select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcstart" /> </xsl:if> </xsl:for-each> </xsl:variable>
<xsl:variable name = "AllLastDate"> <xsl:for-each select="$EventsNode/node [@nodeTypeAlias='Event']"> <xsl:sort select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcend" order="descending" data-type="text"/> <xsl:if test="position()=1"> <xsl:value-of select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcend" /> </xsl:if> </xsl:for-each> </xsl:variable> ............................................... <!-- Get List of All Events --> <xsl:variable name="messages" select="pdcalendar:GenerateDates($AllFirstDate,$AllLastDate,'EventDateInfo')" /> .................. <!--Is date within range and does it have events?--> <xsl:for-each select="$messages/node [umbraco.library:DateGreaterThanOrEqual(@date, $StartDate) and not(umbraco.library:DateGreaterThanOrEqual(@date, $EndDate)) and count(./event) > 0]"> ..do stuff... </xsl:for-each>
The format that the pdcstart and pdcend date are in is 'yyyy-mm-dd', I believe, which means you should be able to pass @date into expressions without doing any formatting. It will be correctly recognized as a date automatically.
Yeah it is because i wish to display in the calendar on the main events page, but i also need to make a simple summary list macro for inclusion on all pages in sub-column.
So i want the next X number of events in the future regardless of their date (but obv they must be in the future).
So really just need to know that pdcstart data is available to compare as datetime (or to transform somehow)?
The macro I showed can be used on any page, the rendering of the dates does not depend on the currentPage in XSLT. By using the date:date() option, you force the events to be returned to start today or later.
Also, the pdcstart is actually a mandatory field, so it is always filled. If you get around that somehow, please tell me because that is not intended use ;)
But, as Heather pointed out, the format is yyyy-mm-dd, so you can use your own option as well if you like.
I'm just getting started with Umbraco and xsl... would it be possible for someone to show me, in like 3rd grade language in crayon... how to get the start and and date for an event and display it along with the title thusly:
Event Title
[Start Date] - [End Date]
Just my newbie opinion, but this should be a LOT easier to get... not EVERYONE needs a calendar in calendar format. :D
Start and End Time
Is there a way to associate a start/end time with an event like the "Datepicker with time" data type? Or is that in the pro version?
No sorry, at the moment that is not available.
I'm planning on updating the package with a slightly different approach for the start- and enddates which will then also include times.
Perhaphs you can add a few properties of your own which contain the start and end times? I don't know how you plan to use it, but could be worth trying.
Peter
Hi Peter
I am trying to list events only in the future in a simple list and have the xslt:
<xsl:for-each select="$newsPage/node[./data[@alias = 'event']/pdcalendarevent/pdcstart!='' and umbraco.library:DateGreaterThanOrEqualToday(umbraco.library:FormatDateTime(./data[@alias = 'event']/pdcalendarevent/pdcstart, 'dd/MM/yyyy'))]">
But it fails and says that:
String was not recognized as a valid DateTime. String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at umbraco.library.DateGreaterThanOrEqualToday(String firstDate)
What format is the pdcstart and how would i format as datetime???
Thanks
J
Hi Josh,
perhaphs an easier approach to get the events is this:
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:exslt="urn:Exslt.ExsltCommon"
xmlns:date="urn:Exslt.ExsltDatesAndTimes"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:pdcalendar="urn:pdcalendar"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets pdcalendar date">
You need to change the 'event' in the GenerateDates() to match the alias of the property PDCalendar you use.
The first parameter represents the current date, the second one adds 1 months to the current date.
The variable will be filled with the veents that will happen in the upcoming month.
Does this help you? Or do you have a specific reason why you want to loop through the nodes like you do now?
Peter
Josh,
I recently did something similar.
This is some of the code I used (keep in mind I made it such that different start & end dates could be specified, so you wouldn't need all of this, but you should get the idea:
The format that the pdcstart and pdcend date are in is 'yyyy-mm-dd', I believe, which means you should be able to pass @date into expressions without doing any formatting. It will be correctly recognized as a date automatically.
I hope this helps.
~Heather
Hey thanks Peter
Yeah it is because i wish to display in the calendar on the main events page, but i also need to make a simple summary list macro for inclusion on all pages in sub-column.
So i want the next X number of events in the future regardless of their date (but obv they must be in the future).
So really just need to know that pdcstart data is available to compare as datetime (or to transform somehow)?
If you were to add a start time and / or end time property, then you could just add the time to the date right? And then test for that.
The macro I showed can be used on any page, the rendering of the dates does not depend on the currentPage in XSLT. By using the date:date() option, you force the events to be returned to start today or later.
Also, the pdcstart is actually a mandatory field, so it is always filled. If you get around that somehow, please tell me because that is not intended use ;)
But, as Heather pointed out, the format is yyyy-mm-dd, so you can use your own option as well if you like.
Oh god i feel stupid now- I had old event nodes that i was ttrying to iterate without having republished with the pdcalendar datatype!
So thanks for time and great info ;) I am sorted now, cheers!
No problem :)
If you have any more questions, just ask!
It appears the calendar wont list any events on the last day of any months?!
Has anyone else found this and solved the issue?
PD any thoughts?
Hm, I thought I solved that in the latest version. What version are you using?
Try downloading the latest version and overwrite the dll in the bin-folder (don't install package, but just extract the package and only use the dll)
If that doesn't help, I need to look into it.
Peter
Cool - Sorted now thanks Peter!
I'm just getting started with Umbraco and xsl... would it be possible for someone to show me, in like 3rd grade language in crayon... how to get the start and and date for an event and display it along with the title thusly:
Event Title
[Start Date] - [End Date]
Just my newbie opinion, but this should be a LOT easier to get... not EVERYONE needs a calendar in calendar format. :D
Thanks in advance!
Figures... 2 minutes after I post I figure it out...
Thanks anyway...
Has any progress been made on adding times to the start and end date pickers?
Hello,
i got this error
Cannot find a script or an extension object associated with namespace 'urn:pdcalendar'.
Thanks
Hi Jignesh
What does your code look like?
/Jan
Hi..
Problem solve its because of framework version at server...
Nevermind, figured it out...
is working on a reply...