IncludeTimeValue == True?

Dec 18, 2014 at 11:18 AM
Hi Andrey,

Thank you for your great job! Not only for CamlJS project, but for SharePoint work at all!

I have a question regrading IncludeTimeValue CAML setting. Is it possible to generate following CAML using Camljs?
    <FieldRef Name="EndDate" />
    <Value Type="DateTime" IncludeTimeValue="True">
        <Today />
I've tried both
 new CamlBuilder().Where()
new CamlBuilder().Where()
but IncludeTimeValue is always false or absent.
Can you please help?
Dec 18, 2014 at 12:10 PM
Edited Dec 18, 2014 at 12:11 PM

Thanks for your feedback, really appreciated!

DateTimeField should have done the trick, but it seems this is a bug. Based on documentation on MSDN, IncludeTimeValue is FALSE by default, though CamlJs seems to think that TRUE is the default value, and this is why the problem happens. Also I just performed some testing using camljs-console and confirmed that time value is not respected if IncludeTimeValue is absent.

Fortunately, this is very easy to fix.

I just applied the fix and pushed the changes to CodePlex.
Please download and try the latest version of camljs.js from Source Code tab.

I'll update the release package, Nuget and Chrome WebStore ASAP.
Dec 18, 2014 at 1:02 PM
Thanks for the fast fix!

But does your fix mean, that every <Value> tag will have IncludeTimeValue=True by default?
Dec 18, 2014 at 1:15 PM
No, at least intention is that if you use DateTimeField, then Value will have IncludeTimeValue = True, all other cases - no.
Not really tested the fix though, some silly mistake is possible of course.
Jan 2, 2016 at 9:15 AM
I've played with this functionality quite a bit over the past few weeks and it works as advertised. However, users really need to be aware upfront of this subtly as DateTime field comparisons are tricky enough without tripping over the inability to change IncludeTimeValue.

My original hack to fix this issue was to replace 'True' with 'False' using javascripts inbuilt replace string functionality . However, I've since discovered that using a Date field as the comparator (ie. <Value Type="Date">) appears to work for DateTime fields as if you used <Value Type="DateTime" IncludeTimeValue="False">.

It would be nice to have the ability to tell CamlJS what you want the value of IncludeTimeValue to be. That way you could equate the Caml string to the actual fields you used rather than implementing a hack.

Does the job either way though... :-)