Skip to content

Commit

Permalink
Merge pull request #3919 from daguiler/bugfix/DNN-33895
Browse files Browse the repository at this point in the history
Enable Scheduling - Add TZ to page StartDate and EndDate
  • Loading branch information
mitchelsellers authored Jul 18, 2020
2 parents d1754e7 + 5a39e65 commit 3e9d129
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions DNN Platform/Library/Common/Utilities/Null.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ public static DateTime SetNullDateTime(object objValue)
return objValue != DBNull.Value ? Convert.ToDateTime(objValue) : NullDate;
}

public static DateTime SetNullDateTime(object objValue, DateTimeKind dateTimeKind)
{
return objValue != DBNull.Value
? DateTime.SpecifyKind(Convert.ToDateTime(objValue), dateTimeKind)
: NullDate;
}

public static int SetNullInteger(object objValue)
{
return objValue != DBNull.Value ? Convert.ToInt32(objValue) : NullInteger;
Expand Down
4 changes: 2 additions & 2 deletions DNN Platform/Library/Entities/Tabs/TabInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,8 @@ public override void Fill(IDataReader dr)
this.SkinSrc = Null.SetNullString(dr["SkinSrc"]);
this.ContainerSrc = Null.SetNullString(dr["ContainerSrc"]);
this.TabPath = Null.SetNullString(dr["TabPath"]);
this.StartDate = Null.SetNullDateTime(dr["StartDate"]);
this.EndDate = Null.SetNullDateTime(dr["EndDate"]);
this.StartDate = Null.SetNullDateTime(dr["StartDate"], DateTimeKind.Utc);
this.EndDate = Null.SetNullDateTime(dr["EndDate"], DateTimeKind.Utc);
this.HasChildren = Null.SetNullBoolean(dr["HasChildren"]);
this.RefreshInterval = Null.SetNullInteger(dr["RefreshInterval"]);
this.PageHeadText = Null.SetNullString(dr["PageHeadText"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ class PageDetailsFooter extends Component {

onChangeValue(key, value) {
const {onChangeField} = this.props;

switch (key) {
case "startDate":
case "endDate":
// the DatePicker returns strings, but we need dates
value = new Date(value);
break;
}

onChangeField(key, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ const PageService = function () {
const toFrontEndPage = function (pageResult) {
return {
...pageResult.page,
schedulingEnabled: pageResult.page.startDate || pageResult.page.endDate,
schedulingEnabled: pageResult.page.startDate !== null || pageResult.page.endDate !== null,
// the API returns strings, but we need dates
startDate: pageResult.page.startDate === null ? null : new Date(pageResult.page.startDate),
endDate: pageResult.page.endDate === null ? null : new Date(pageResult.page.endDate),
validationCode: pageResult.ValidationCode,
};
};
Expand Down

0 comments on commit 3e9d129

Please sign in to comment.