Skip to content

Commit

Permalink
fix(custom-fields): fix time range timezone_id (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidRouyer authored Oct 11, 2022
1 parent 602ce27 commit 14961f7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public async Task CanEdit()
editDeal.CustomFields["29ea3aec79d40dc23717c8dc2ae733b80d4d106d"] = new DateCustomField(new DateTime(2018, 12, 31));
editDeal.CustomFields["fafd71954fc387aad08186ab7aead0697fba4229"] = new DateRangeCustomField(new DateTime(2018, 12, 30), new DateTime(2018, 12, 31));
editDeal.CustomFields["bde564bd45f0381b54eea85d5c70a904d17458d9"] = new TimeCustomField(new TimeSpan(23, 59, 59), 0);
editDeal.CustomFields["9ef10a2bcd8d149ddd0a64988762dc5a080a9230"] = new TimeRangeCustomField(new TimeSpan(23, 59, 58), new TimeSpan(23, 59, 59), 0);
editDeal.CustomFields["9ef10a2bcd8d149ddd0a64988762dc5a080a9230"] = new TimeRangeCustomField(new TimeSpan(23, 59, 58), new TimeSpan(23, 59, 59), new TimeSpan(0, 0, 0));
editDeal.CustomFields["2008db4fe093862089023b01ad80feabac24d7d0"] = new AddressCustomField("value", "subpremise", "streetNumber", "route", "sublocality", "locality", "adminAreaLevel1", "adminAreaLevel2", "country", "postalCode", "formattedAddress");
editDeal.CustomFields["8a1cf3eacd582191a48730b5d953daa877c0ebe7"] = new StringCustomField("0606060606"); // Phone
editDeal.CustomFields["796428c82dfc3595032a4330238aa06d354db5da"] = new StringCustomField("4"); // Single option
Expand All @@ -171,7 +171,7 @@ public async Task CanEdit()
Assert.Equal(0, ((TimeCustomField)updatedDeal.CustomFields["bde564bd45f0381b54eea85d5c70a904d17458d9"]).TimezoneId);
Assert.Equal(new TimeSpan(23, 59, 58), ((TimeRangeCustomField)updatedDeal.CustomFields["9ef10a2bcd8d149ddd0a64988762dc5a080a9230"]).StartTime);
Assert.Equal(new TimeSpan(23, 59, 59), ((TimeRangeCustomField)updatedDeal.CustomFields["9ef10a2bcd8d149ddd0a64988762dc5a080a9230"]).EndTime);
Assert.Equal(0, ((TimeRangeCustomField)updatedDeal.CustomFields["9ef10a2bcd8d149ddd0a64988762dc5a080a9230"]).TimezoneId);
Assert.Equal(new TimeSpan(0, 0, 0), ((TimeRangeCustomField)updatedDeal.CustomFields["9ef10a2bcd8d149ddd0a64988762dc5a080a9230"]).TimezoneId);
Assert.Equal("value", ((AddressCustomField)updatedDeal.CustomFields["2008db4fe093862089023b01ad80feabac24d7d0"]).Value);
Assert.Equal("0606060606", ((StringCustomField)updatedDeal.CustomFields["8a1cf3eacd582191a48730b5d953daa877c0ebe7"]).Value);
Assert.Equal("4", ((StringCustomField)updatedDeal.CustomFields["796428c82dfc3595032a4330238aa06d354db5da"]).Value);
Expand Down
2 changes: 1 addition & 1 deletion src/Pipedrive.net/Converters/CustomFieldConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
customFields.Add(property.Name, new TimeRangeCustomField(
TimeSpan.Parse((string)property.Value),
TimeSpan.Parse((string)linkedProperties[$"{property.Name}_until"]),
(int)linkedProperties[$"{property.Name}_timezone_id"]));
TimeSpan.Parse((string)linkedProperties[$"{property.Name}_timezone_id"])));
}

// Time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class TimeRangeCustomField : ICustomField

public TimeSpan EndTime { get; set; }

public int TimezoneId { get; set; }
public TimeSpan TimezoneId { get; set; }

public TimeRangeCustomField(TimeSpan startTime, TimeSpan endTime, int timezoneId)
public TimeRangeCustomField(TimeSpan startTime, TimeSpan endTime, TimeSpan timezoneId)
{
StartTime = startTime;
EndTime = endTime;
Expand Down

0 comments on commit 14961f7

Please sign in to comment.