U4-7061 - DatePicker (without time) subtracts a date on each Save and Publish submission

Created by nik mihalick 02 Sep 2015, 18:19:19 Updated by Shannon Deminick 09 Sep 2015, 09:01:42

Using a standard Date property, the value subtracts a day on each Save and Publish submission. To reproduce (assuming a date property already exists on the doc type):

  1. I set the date to 2015-09-02.
  2. I save and publish.
  3. I navigate away and return.
  4. I save and publish again (no changes made to any content, but it happens if you do that).
  5. I navigate away and come back. The date is now 2015-09-01.

I've tracked it down to umbraco.controller.js > dateTimePickerController > unsubscribe. The affecting code is: $scope.model.value = $element.find("div:first").data().DateTimePicker.getDate().format("YYYY-MM-DD");

Running the following javascript in the chrome js console on a backoffice page with the field returns the same issue:

(('div.umb-editor.umb-datepicker.ng-scope')[0]).find("div:first").data(); Object {DateTimePicker: DateTimePicker, date: "2015-09-01"}

Could there be a timestamp configuration somewhere that is causing this?

This is related to one of the last comments in issue U4-6953.

Comments

Sebastiaan Janssen 02 Sep 2015, 20:27:27

Does it help when you apply the fix from this comment by Shannon: http://issues.umbraco.org/issue/U4-6953#comment=67-22283 ?

Make sure to change the version number in ClientDependency.config (just add 1 or subtract one from the current version).

Ps. I'm assuming you use 7.2.8.


Shannon Deminick 08 Sep 2015, 16:58:24

@nmihalick

Hrm, this is quite odd. I cannot reproduce this either. I'm testing this with the latest 7.3 code.

the date picker uses the 'moment' library underneath but it's not configured to use any timezone information so it's not changing the data on it's own.

I'm wondering if the data changes is coming from the server in some way. Does this happen for every date and it's always by one day ? What if you use a date + time picker, what happens then?

Also, we need to know what version you are using.


nik mihalick 08 Sep 2015, 18:00:22

@Shandem I found using 7.2.8. It is only with the date property. DateTime doesn't have that issue (but ran into U4-6953 when converting). I applied the change listed in U4-6953 late last week and the issue has not come up again for our users. If that is applied in 7.3, then this issue may already be solved in that version.

I don't believe there is server interaction happening, but I don't know enough about the inner workings of moment and angular to know that for certain. I used the chrome js debugger, set a watch on the scope, and the line I pasted in the details is where the data change occurred. I didn't notice any interactions with the server while running the debugger.


Shannon Deminick 09 Sep 2015, 09:01:16

Ok thanks for the reply. Yes we merge upwards always so any fix applied in previous versions are applied to latest versions. I will close the issue.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.3.0

Sprint:

Story Points:

Cycle: