Created date is incorrect when creating records

Are you looking for help?

This is a support forum for reporting issues related to Backendless services. Please note that due to our support policy we cannot provide you help with debugging your code, consulting in regards to any language or third-party library usage. For this kind of questions we recommend using more appropriate forums like Stack Overflow.

In order to suggest you a quality solution, we shall usually ask you to provide the details mentioned below first. Including them into your topic right away helps us to start investigating your issue much faster.

In case you have a suggestion or an idea, the details below are not always required, though still any additional background is welcome.

Backendless Version (3.x / 6.x, Online / Managed / Pro )

Online

Client SDK (REST / Android / Objective-C / Swift / JS )

c# .NET && Xamarin Forms

Application ID

4175749B-9BDE-DAD3-FFC3-32ECBE027500

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

Be descriptive: “it doesn’t work” does not describe what the behavior actually is – instead, say “the request returns a 400 error with message XXX”. Copy and paste your logs, and include any URLs.

1.Create a new record using typed classes in c# / Xamarin
2. Check record in App Tables db
3. Created datetime is always incorrect
4. DateTime: 12/31/0000 23:59:45

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

1.Create a new record using typed classes in c# / Xamarin
2. Check record in App Tables db
3. Created datetime should be correct

Reproducible Test Case

Please provide a simple code that could be run in a new clean app and reproduce the issue.

If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

public class TrainingExercise : BaseDataClass
{
public TrainingExercise()
{
recordType = RecordType.TrainingExercise;
CanBeDeleted = true;
}

    public TrainingExerciseDocument Document { get; set; } = new TrainingExerciseDocument();
}

public class TrainingExerciseDocument
{
    public string Element { get; set; }
    public string Name { get; set; }
    public string Link { get; set; }
    public string[] AccessType { get; set; }
    public string Tenant { get; set; }
}

public async Task SaveExercise(TrainingExercise trainingExercise)
{
try
{
var data = await IDataAccess.Instance.SaveData(trainingExercise);
}
catch(Exception err)
{
await Singleton.Instance.App.MainPage.DisplayAlert(“Error”, err.Message + ": " + err.StackTrace, “OK”);
}
}

Hello @Andrew_Lewis

Thank you for reporting the problem!

We have started looking into your issue and will get back to you shortly.

Regards,
Alexander

1 Like

@Andrew_Lewis,

Can you show what BaseDataClass looks like? The problem is most likely in this class.

Regards,
Alexander

Hi Alex.

I have tried with both the following:

using System;

namespace Shared.Core
{
public class BaseDataClass
{
public string objectId { get; set; }
public string ownerId { get; set; }
public DateTime created { get; set; }
public DateTime updated { get; set; }
public string recordType { get; set; }
public bool CanBeDeleted { get; set; }
public bool Global { get; set; }
}
}

using System;

namespace Shared.Core
{
public class BaseDataClass
{
public string objectId { get; set; }
public string ownerId { get; set; }
public string recordType { get; set; }
public bool CanBeDeleted { get; set; }
public bool Global { get; set; }
}
}

Hi Andrew,

What is the version of the Backendless SDK for .NET you use?

Regards,
Mark

1 Like

Hi @Andrew_Lewis

Please try replacing DateTime with DateTime?
The value you are sending is not null and replaces the real value

Regards,
Alexander

Hi, I’m using Backendless.NET 6.2.0.

Replace DateTime with DateTime?

@Andrew_Lewis DateTime to DateTime?
Add a question mark to the name of the data type.

Regards, Nikita.

Ahh, doh, sorry my fault. :man_facepalming:

I’ll check that now

Maaaan, I feel like such an idiot…Friday’s!

I do apologise for wasting your time. It all works perfectly now. Thank you.

Awesome product by the way, looking forward to seeing how it scales. :+1:

2 Likes