-
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Using the generated code to write back records and update records to a table called "Game" containing a "Date (UTC)" column. The values are always written back as null value.
Using following code
game = pb.Data.GamesCollection.Filter(....).FirstOrDefault();
var datetime = DateTime.Now;
game.Date = datetime;
game.Save();
The Date column value for the specific record will be null.
The bug is detected in following file:
sdk/pocketbase-csharp-sdk/Json/DateTimeConverter.cs
...
public class DateTimeConverter : JsonConverter<DateTime?>
{
....
public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options)
{
if (value is null)
{
writer.WriteNullValue();
}
else
{
/// => is the current code : writer.WriteStringValue(value?.ToString());
/// Must be replaced by
writer.WriteStringValue(value?.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"));
}
}
}
...
Metadata
Metadata
Assignees
Labels
No labels