To conclude, the cause of problem was the use of Farsi calendar, for whatever reason it couldn't get the format right and therefore not able to convert it to Gergorian calendar for saving in db. I used my own date converter and problem is solved.
As it also didn't inform user of invalid date entry I also added date validator to controls/EditUsersProfile.asx.cs.
/// <summary>
/// The update profile_ click.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
protected void UpdateProfile_Click([NotNull] object sender, [NotNull] EventArgs e)
{
if(this.Birthday.Text.IsSet() && !isValidDate(this.Birthday.Text)){
this.PageContext.AddLoadMessage(this.GetText("PROFILE", "BAD_DATE"), MessageTypes.Warning);
return;
}
.....
private bool isValidDate(string dateStr)
{
if (this.Get<YafBoardSettings>().UseFarsiCalender)
{
try
{
persianDate = new PersianDate(this.Birthday.Text);
return true;
}
catch
{
return false;
}
}
else
{
DateTime dt;
return DateTime.TryParse(dateStr, out dt);
}
}
And I added the BAD_DATE tag to PROFILE page of language files.
Edited by user
9 years ago
|
Reason: Not specified