Q:

Get a new copy of a variable from a Typescript kendo.data.ObservableObject

I have a kendo.data.ObservableObject which has two Date fields - EventDate and EventEndDate.  When the EventDate is changed, I want to set the EventDateDate = EventDate + 7 days.
I have the following code:
    //set calculated fields
    modelObservable.bind("change", function (e) {
        if (e.field == "EventDate") {
            //get the date
            var endDate = <Date>this.get("EventDate");
            //add 7
            endDate.setDate(endDate.getDate() + 7);
            //bind
            this.set("EventEndDate", endDate);
        }
    });

Does seem to work, however I only recently discovered a bug (via a validation failure), in that once this function has finished completely, EventDate and EventEndDate are the same. Presumably
this.get("EventDate");

is creating a reference instead of a new value - how can I get around this?
Current results are as follows:

Set Event Date to 01/11/2015
The Handler fires and calculates the new Date to be 08/11/2015
On the webpage, Event Date is 01/11/2015, and the End Date 08/11/2015 (correct)

but in the Observable object, Event Date and Event End Date are both 08/11/2015, and these are what gets saved to the Database after we parse the Observable into JSON and send to our WCF service

A:

Yes, you need to create a new Date object, otherwise you modify existing object instance:
// Set calculated fields
modelObservable.bind("change", function (e) {
    if (e.field == "EventDate") {
        // get the date
        var eventDate = <Date>this.get("EventDate");
        // Clone Date object
        var result = new Date(eventDate.getTime());
        // add 7
        result.setDate(result.getDate() + 7);
        // bind
        this.set("EventEndDate", result);
    }
});

