Skip to content

Commit

Permalink
Fix bug with full day due dates
Browse files Browse the repository at this point in the history
  • Loading branch information
olsh committed Dec 21, 2021
1 parent 56ddc23 commit 9bdc73b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Todoist.Net.Tests/Services/ItemsServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public void CreateItemClearDueDateAndDelete_Success()
{
var client = TodoistClientFactory.Create();

var item = new Item("demo task") { DueDate = new DueDate(DateTime.Today, true) };
var item = new Item("demo task") { DueDate = new DueDate("22 Dec 2021", null, Language.English) };
client.Items.AddAsync(item).Wait();

var itemInfo = client.Items.GetAsync(item.Id).Result;

Assert.True(itemInfo.Item.Content == item.Content);
Assert.NotNull(itemInfo.Item.DueDate);
Assert.Equal("2021-12-22", itemInfo.Item.DueDate.StringDate);

itemInfo.Item.DueDate = null;
client.Items.UpdateAsync(itemInfo.Item).Wait();
Expand Down
4 changes: 2 additions & 2 deletions src/Todoist.Net/Models/DueDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ internal string StringDate
return null;
}

var date = Date.Value.ToUniversalTime();
if (IsFullDay)
{
return date.ToString(FullDayEventDateFormat);
return Date.Value.ToString(FullDayEventDateFormat);
}

var date = Date.Value.ToUniversalTime();
if (string.IsNullOrEmpty(Timezone))
{
return date.ToString("s");
Expand Down
2 changes: 1 addition & 1 deletion src/Todoist.Net/Todoist.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>A Todoist API client for .NET</Description>
<VersionPrefix>2.2.1</VersionPrefix>
<VersionPrefix>2.2.2</VersionPrefix>
<Authors>Oleg Shevchenko</Authors>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down

0 comments on commit 9bdc73b

Please sign in to comment.