odataorg.github.io icon indicating copy to clipboard operation
odataorg.github.io copied to clipboard

DateTimeOffset handling in formatDateTimeOffset

Open tonyjoanes opened this issue 6 years ago • 0 comments

We're using some DateTimeOffset datatypes in our MSSQL database and require the offset to be passed back to the server.

The function formatDateTimeOffset performs a hasOffset check on the value passed in but this only receives a DateTime from what I have seen. The means it never returns a DateTimeOffset from the function and we can't receive the correct value back on the server.

The check it performs on the value is the following snippet of code and it assumes fields that the parameter never has.

var isDateTimeOffset = function (value) {
        /// <summary>Checks whether a Date object is DateTimeOffset value</summary>
        /// <param name="value" type="Date" mayBeNull="false">Value to check.</param>
        /// <returns type="Boolean">true if the value is a DateTimeOffset, false otherwise.</returns>
        return (value.__edmType === "Edm.DateTimeOffset" || (!value.__edmType && value.__offset));
    };

I can hack around this but I am wondering if there is some setup missing from somewhere to get DateTimeOffsets to play nicely with the BreezeJS and DataJs frameworks.

tonyjoanes avatar Sep 20 '19 09:09 tonyjoanes