Skip to content

Commit b8b7e0f

Browse files
authored
fix DateTime parse issue (#219)
* fix DateTime parse issue * try parse more exactly * add culture info
1 parent b58ba40 commit b8b7e0f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Common/CustomAttributes/GenericBreakingChangeAttribute.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.WindowsAzure.Commands.Common.Properties;
1616
using System;
1717
using System.Collections.Generic;
18+
using System.Globalization;
1819
using System.Linq;
1920
using System.Management.Automation;
2021
using System.Text;
@@ -68,8 +69,11 @@ public GenericBreakingChangeAttribute(string message, string deprecateByVersion,
6869
this.DeprecateByVersion = deprecateByVersion;
6970
this.DeprecateByVersionSet = true;
7071

71-
this.ChangeInEfectByDate = DateTime.Parse(changeInEfectByDate);
72-
this.ChangeInEfectByDateSet = true;
72+
if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result))
73+
{
74+
this.ChangeInEfectByDate = result;
75+
this.ChangeInEfectByDateSet = true;
76+
}
7377
}
7478

7579
public DateTime getInEffectByDate()

0 commit comments

Comments
 (0)