Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/wix/WixToolset.Data/ErrorMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ public static Message InvalidBundleCondition(SourceLineNumber sourceLineNumbers,

public static Message InvalidDateTimeFormat(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string value)
{
return Message(sourceLineNumbers, Ids.InvalidDateTimeFormat, "The {0}/@{1} attribute's value '{2}' is not a valid date/time value. A date/time value should follow the format YYYY-MM-DDTHH:mm:ss.", elementName, attributeName, value);
return Message(sourceLineNumbers, Ids.InvalidDateTimeFormat, "The {0}/@{1} attribute's value '{2}' is not a valid date/time value. A date/time value should follow the format YYYY-MM-DDTHH:mm:ss and be a valid date and time between 1980 and 2043, inclusive.", elementName, attributeName, value);
}

public static Message InvalidDocumentElement(SourceLineNumber sourceLineNumbers, string elementName, string fileType, string expectedElementName)
Expand Down
5 changes: 5 additions & 0 deletions src/wix/WixToolset.Core/CompilerCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ public int GetAttributeDateTimeValue(SourceLineNumber sourceLineNumbers, XAttrib
{
DateTime date = DateTime.Parse(value, CultureInfo.InvariantCulture.DateTimeFormat);

if (date.Year < 1980 || date.Year > 2043)
{
this.Write(ErrorMessages.InvalidDateTimeFormat(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value));
}

return ((((date.Year - 1980) * 512) + (date.Month * 32 + date.Day)) * 65536) +
(date.Hour * 2048) + (date.Minute * 32) + (date.Second / 2);
}
Expand Down