DateTimePicker throws error "The input was not valid"

Syncfusion 19.4.0.55

I have a data grid with a modal edit form.  That form has two DateTimePickers.  When I use them to change (update) the time, I get the error "The input was not valid"

Entity:

    public partial class Training

    {

        [Required(ErrorMessage = "Start date is required")]

        [Display(Name = "Start Date")]

        public DateTime StartDate { get; set; }


        [Required(ErrorMessage = "End date is required")]

        [Display(Name = "End Date")]

        public DateTime EndDate { get; set; } 

   }

Razor:

<GridColumns>

                <GridColumn Field=@nameof(Training.StartDate)

                            HeaderText="Start Date"

                            Format="MM/dd/yy HH:mm tt"

                            Width="120"

                            Type="ColumnType.Date">

                </GridColumn>

                <GridColumn Field=@nameof(Training.EndDate)

                            HeaderText="End Date"

                            Format="MM/dd/yy HH:mm tt"

                            Width="120"

                            Type="ColumnType.Date"

                            Visible="false">

                </GridColumn>

</GridColumns>

 <GridEditSettings AllowAdding="true"

                                  AllowDeleting="true"

                                  AllowEditing="true"

                                  ShowDeleteConfirmDialog="true"

                                  Mode="EditMode.Dialog"

                                  Dialog="TrainingGridDialogParams">

                    <Template>

                        <DataAnnotationsValidator />

                        @{ var Training = (context as Training);}

                        <div class="form-row">

                            <div class="form-group col-md-6">

                                <label class="e-label-top">Start Date</label>

                                <SfDateTimePicker TValue="DateTime"

                                                  AllowEdit="true"

                                                  @bind-Value="@Training.StartDate"

                                                  Format="MM/dd/yy HH:mm tt">

                                </SfDateTimePicker>

                            </div>

                            <div class="form-group col-md-6">

                                <label class="e-label-top">End Date</label>

                                <SfDateTimePicker TValue="DateTime"

                                                  AllowEdit="true"

                                                  @bind-Value="@Training.EndDate"

                                                  Format="MM/dd/yy HH:mm tt">

                                </SfDateTimePicker>

                            </div>

                        </div>

                    </Template>

                </GridEditSettings>


9 Replies

RS Renjith Singh Rajendran Syncfusion Team March 11, 2022 11:57 AM UTC

Hi Scot, 
 
Greetings from Syncfusion support. 
 
We checked this scenario by creating a sample based on your shared codes. But we could not face the reported problem, when changing values in SfDateTimePicker. We are attaching the sample for your reference. 
 
Kindly download and refer the sample and check this from your side. If you are still facing difficulties then the following details would be helpful for us to proceed further. 
 
  1. Share a simple issue reproducing sample for us to validate.
  2. Share the exact scenario you are facing this problem.
  3. Share a video demo showing the replication of the problem.
 
The provided information will help us analyze the problem, and provide you a solution as early as possible. 
 
Regards, 
Renjith R 



SW Scot Woodyard replied to Renjith Singh Rajendran March 12, 2022 04:11 AM UTC

My apologies - I forgot the most important part:


                <SfDataManager @ref="TrainingGridDataManager"

                               Url="@TrainingAPIUrl"

                               Adaptor="Adaptors.ODataV4Adaptor"

                               Headers=@HeaderData

                               >

                </SfDataManager>

So, when the Save in the modal dialog is clicked, it is attempting to update the record via the Odata adaptor.  That is when the error is thrown.  



RS Renjith Singh Rajendran Syncfusion Team March 14, 2022 11:28 AM UTC

Hi Scot, 
 
We checked this scenario by creating a sample. But we could not face the reported problem, when changing values in SfDateTimePicker and click save button. We are attaching the sample for your reference.  
 
Kindly download and refer the sample and check this from your side. If you are still facing difficulties then the kindly share with us the details requested from our previous update for us to proceed further.  
 
Regards, 
Renjith R 



SW Scot Woodyard replied to Renjith Singh Rajendran March 14, 2022 10:12 PM UTC

Your example throws a null value exception.  See attached video.


Attachment: Untitled_Project_2aee61b2.zip


RS Renjith Singh Rajendran Syncfusion Team March 15, 2022 12:07 PM UTC

Hi Scot, 
 
We checked the sample from our side, we could not face the null exception with the shared sample from our side. We are attaching a video for your reference, please download and refer the video from link below, 
 
And also from your previous updates, you have reported problem “changing value in DatePicker will show the validation error message” as problem from your side. We would like to inform you that the PATCH method won’t be triggered when clicking the save action, if there is a validation error occurred in edit form dialog. So your reported problem(changing value in DatePicker will show the validation error message) is not reproduced with the sample from our side(as the PATCH method triggered successfully in the sample). 
 
So kindly check our previously attached sample and as requested in our previous updates, kindly share with us the requested details to further proceed on this based on your exact scenario. 
 
  1. Share a simple issue reproducing sample for us to validate.
  2. Share the exact scenario you are facing this problem.
  3. Share a video demo showing the replication of the problem.
  4. Share the complete grid rendering codes along with complete model class codes.
 
Regards, 
Renjith R 



SW Scot Woodyard March 16, 2022 03:53 AM UTC

Attached is a .zip file with a simple  issue reproducing sample AND a video showing the replication of the problem.


Attachment: ITSSMaster.ODATA_e994e925.zip


RS Renjith Singh Rajendran Syncfusion Team March 16, 2022 04:10 PM UTC

Hi Scot, 
 
Thanks for sharing the details. 
 
We could see that you are referring to the problem of getting null value in patch argument of UpdateTraining when changing only the time value from DateTimePicker. If so, then we could reproduce the reported issue from our side.  
 
We are further analyzing the reported problem from our side. We will update you further details within two business days. Until then we appreciate your patience. 
 
Regards, 
Renjith R 



RS Renjith Singh Rajendran Syncfusion Team March 21, 2022 11:40 AM UTC

Hi Scot, 
 
We have confirmed this as an issue and logged the defect report “DateTimeKind is set to Unspecified in DateTimePicker’s value (time value)”  for the same. Thank you for taking time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the fix in our upcoming weekly patch release which is expected to be rolled out on April 13, 2022.  
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.         
 
Regards, 
Renjith R 



VN Vignesh Natarajan Syncfusion Team April 22, 2022 04:53 AM UTC

Hi Scot,


We have fixed the reported DateTimeKind is set to Unspecified in DateTimePicker’s value (time value) issue from our end in the 20.1.48 version. So, we suggest you upgrade to our latest version to resolve the current issue.

Please find the release notes here : https://blazor.syncfusion.com/documentation/release-notes/20.1.48?type=all#bug-fixes-4


Regards,  

Vignesh Natarajan


Loader.
Up arrow icon