locked
Document Set dd.mm.yyyy Date Time problem "String was not recognized as a valid DateTime." RRS feed

  • Question

  • We have a situation where our SharePoint 2013 site's regional settings are Finnish. That means the date format is dd.mm.yyyy. We created a document set content type with a datetime column.

    The datepicker in that field works as It should and the date given by it is in a correct format. But when we pick a date 25.1.2013 (25th of january) we have an error when saving the document set: "String was not recognized as a valid DateTime." If we change the date to 9.1.2013 (9th january) the save will succeed, but displaying the properties shows us the date was saved as  1.9.2013 (1st of september).

    This only happens when creating a new Document Set. If we edit it and save, the date field works like it should. Also this doesn't happen in custom lists or document content types. Only Document Sets. The document set content type was created manually trought site administration, no visual studio or xml was used. This happens on an On-Premise server and on the SharePoint Online Preview.

    We've tried settings users locale from user profile, but no luck.

    Is this a bug or is there something we don't see?


    • Edited by JyrKet Friday, January 25, 2013 11:27 AM
    Friday, January 25, 2013 10:56 AM

Answers

  • Hi,

    We had the same problem with the Dutch language pack /
    regional settings. Entering a value within a date time field of a document set,
    resulted in an error "String was not recognized as a valid
    DateTime."

    We had it reproduced by Microsoft and tested KB2767999
    as a resolution (SharePoint 2013 cumulative update march 2013).

    While the reference of KB2767999 did not mention
    fixing this problem it worked for us.

    Good luck!



    • Edited by Sjoerd van Lochem Monday, March 18, 2013 1:57 PM
    • Proposed as answer by icoatr Tuesday, April 9, 2013 1:12 PM
    • Marked as answer by JyrKet Friday, April 19, 2013 9:14 AM
    Monday, March 18, 2013 1:57 PM

All replies

  • Hi JyrKet,

    I tried to reproduce your issue and it is showing the same behavior on my on-premise environment. It certainly does look like a bug.

    As a workaround, you can create the document set without entering the date and edit its properties afterwards. When I try it this way, the date is properly saved. 

    Not a real solution, but it might help you until somebody comes up with one :-)

    Friday, January 25, 2013 3:49 PM
  • As a workaround, you can create the document set without entering the date and edit its properties afterwards. When I try it this way, the date is properly saved. 

    Not a real solution, but it might help you until somebody comes up with one :-)

    Yes, this is how we've been doing while building and testing the site. But really we can't present this as a solution to our customer.

    Seems that the newdocset.aspx page is somehow handling the date differently than the other list forms, but we've not yet figured out what exactly.

    Monday, January 28, 2013 8:52 AM
  • Did you find the solution? I have some issue.
    Friday, February 15, 2013 10:14 AM
  • Hi,

    I have the same problem in our system. Seems like, this is because the DateTime field value is handled as string and committed as string in a hashtable to the "DocumentSet.Create" function, which is sending the hashtable to SPListItem.SetValue where a DateTime value as string is parsed using the following code-line 

    time = System.DateTime.Parse(value.ToString(), System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.AdjustToUniversal);

    regretfully they are using System.Globalization.DateTimeFormatInfo.InvariantInfo and not System.Globalization.DateTimeFormatInfo.CurrentInfo

    I tried already to use an Event-Receiver to manipulate the date value before adding the document set to the list, but the exception occurs before the event receiver is called.

    My second approach was to rewrite the date with javascript onsubmit, but then the input validation of the field failed.

    Maybe its possible to deploy a custom newdocset page..

    Friday, February 15, 2013 3:26 PM
  • I tried already to use an Event-Receiver to manipulate the date value before adding the document set to the list, but the exception occurs before the event receiver is called.

    My second approach was to rewrite the date with javascript onsubmit, but then the input validation of the field failed.

    Maybe its possible to deploy a custom newdocset page..

    We also figured out this invariantinfo and currentinfo ourselves, but havent really had time for finding/testing the best workaround.

    Did you try the last one? Or has someone found a fix or another workaround for this.

    Monday, March 18, 2013 1:54 PM
  • Hi,

    We had the same problem with the Dutch language pack /
    regional settings. Entering a value within a date time field of a document set,
    resulted in an error "String was not recognized as a valid
    DateTime."

    We had it reproduced by Microsoft and tested KB2767999
    as a resolution (SharePoint 2013 cumulative update march 2013).

    While the reference of KB2767999 did not mention
    fixing this problem it worked for us.

    Good luck!



    • Edited by Sjoerd van Lochem Monday, March 18, 2013 1:57 PM
    • Proposed as answer by icoatr Tuesday, April 9, 2013 1:12 PM
    • Marked as answer by JyrKet Friday, April 19, 2013 9:14 AM
    Monday, March 18, 2013 1:57 PM
  • Hi,

    We had the same problem with the Dutch language pack /
    regional settings. Entering a value within a date time field of a document set,
    resulted in an error "String was not recognized as a valid
    DateTime."

    We had it reproduced by Microsoft and tested KB2767999
    as a resolution (SharePoint 2013 cumulative update march 2013).

    While the reference of KB2767999 did not mention
    fixing this problem it worked for us.

    Good luck!



    We finally had time to verify this solution. It works.
    Friday, April 19, 2013 9:14 AM