Skip to content

Commit

Permalink
fix date conversion bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
NuLL3rr0r committed May 7, 2020
1 parent d8350ca commit cdd90a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CoreLib/CDate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ std::string DateConv::ToGregorian(const int jYear, const int jMonth, const int j

boost::locale::date_time jalali(
boost::locale::period::year(jYear)
+ boost::locale::period::month(jMonth + 1)
+ boost::locale::period::month(jMonth - 1)
+ boost::locale::period::day(jDay),
locale_jalali);

Expand Down Expand Up @@ -217,7 +217,7 @@ std::string DateConv::ToJalali(int gYear, int gMonth, int gDay)

boost::locale::date_time gregorian(
boost::locale::period::year(gYear)
+ boost::locale::period::month(gMonth + 1)
+ boost::locale::period::month(gMonth - 1)
+ boost::locale::period::day(gDay),
locale_gregorian);

Expand Down Expand Up @@ -255,8 +255,8 @@ std::string DateConv::ToJalali(const std::time_t rawTime, const CDate::Timezone
timeInfo = localtime(&rawTime);
}

return DateConv::ToJalali(timeInfo->tm_mday,
timeInfo->tm_mon + 1, timeInfo->tm_year + 1900);
return DateConv::ToJalali(timeInfo->tm_year + 1900,
timeInfo->tm_mon + 1, timeInfo->tm_mday);
}

std::string DateConv::Time(const CDate::Now &now)
Expand Down

0 comments on commit cdd90a7

Please sign in to comment.