After a few nightmare days of trying to figure out why my published blog won't run some of my macros, I have managed to isolate the problem and pinpoint the source of the errors.
What the hell is really wrong with it, really?
I had tried retyping it several times - letter by letter, still no luck.
Strange thing is, it works on my local machine with no problem at all, and I can open both the local website and the published website one next to eachother and the online one won't run the macros that contain that module.
If all the logic works fine on other machines I will bet you a beer that the problem site has a node somewhere with an empty PostDate property...
Try putting an if statement around this logic to test for that, e.g.:
<xsl:if test="normalize-space($post/PostDate)">
<!-- logic from above -->
</xsl:if>
One other thing that may be able to trigger problems with stuff like this, is when the locales differ on the machines - date functions use Culture info and depending on the functions used they can generate differing output from locale to locale...
Thanks but it's not an empty PostDate property - I have just tried the if statement. :(
Also, because of the way the logic is made, it formats all date variables using FormatDateTime() which means that regardless of the current date and the way it is displayed it should format it and prepare it for DateDiff().
I think you will be better off not using FormatDateTime() before you need to display the date - all calculations should use the "native" date format, so you're not accidentally comparing to different formats.
Did you check the locale settings? Are the machines set to different locales/languages?
Lucky for you, I removed the Format date functions before any calculations (for all 3 macros that didn't work) and now they do work!!! - which means you don't owe me a beer anymore hehe. :)
That's why I would get the same errors on a different user locally on the same computer, because the local date format was different.
You have been of great help Chriztian, thank you so much!
DateDiff() parsing error
Hello,
After a few nightmare days of trying to figure out why my published blog won't run some of my macros, I have managed to isolate the problem and pinpoint the source of the errors.
It's this guy over here:
which is part of this section that calculates the time since the current post has been published:
What the hell is really wrong with it, really? I had tried retyping it several times - letter by letter, still no luck.
Strange thing is, it works on my local machine with no problem at all, and I can open both the local website and the published website one next to eachother and the online one won't run the macros that contain that module.
I need some help, please
Hi Alexandru,
If all the logic works fine on other machines I will bet you a beer that the problem site has a node somewhere with an empty PostDate property...
Try putting an if statement around this logic to test for that, e.g.:
One other thing that may be able to trigger problems with stuff like this, is when the locales differ on the machines - date functions use Culture info and depending on the functions used they can generate differing output from locale to locale...
/Chriztian
Hi Chriztian,
Thanks but it's not an empty PostDate property - I have just tried the if statement. :(
Also, because of the way the logic is made, it formats all date variables using FormatDateTime() which means that regardless of the current date and the way it is displayed it should format it and prepare it for DateDiff().
Am I right?
None of the PostDate properties may be empty as I have made them mandatory.
Alright - guess I owe you a beer then :-)
I think you will be better off not using FormatDateTime() before you need to display the date - all calculations should use the "native" date format, so you're not accidentally comparing to different formats.
Did you check the locale settings? Are the machines set to different locales/languages?
/Chriztian
Lucky for you, I removed the Format date functions before any calculations (for all 3 macros that didn't work) and now they do work!!! - which means you don't owe me a beer anymore hehe. :)
That's why I would get the same errors on a different user locally on the same computer, because the local date format was different.
You have been of great help Chriztian, thank you so much!
Phew :)
/Chriztian
is working on a reply...