mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601d: Upgraded method from private to static public
This commit is contained in:
parent
69a60103b9
commit
ae22612584
2 changed files with 12 additions and 11 deletions
|
@ -826,16 +826,6 @@ bool ISO8601d::parse_time_off_ext (Nibbler& n)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Using Zeller's Congruence.
|
||||
int ISO8601d::dayOfWeek (int year, int month, int day)
|
||||
{
|
||||
int adj = (14 - month) / 12;
|
||||
int m = month + 12 * adj - 2;
|
||||
int y = year - adj;
|
||||
return (day + (13 * m - 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Validation via simple range checking.
|
||||
bool ISO8601d::validate ()
|
||||
|
@ -1483,6 +1473,17 @@ int ISO8601d::dayOfWeek (const std::string& input)
|
|||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Using Zeller's Congruence.
|
||||
// Static
|
||||
int ISO8601d::dayOfWeek (int year, int month, int day)
|
||||
{
|
||||
int adj = (14 - month) / 12;
|
||||
int m = month + 12 * adj - 2;
|
||||
int y = year - adj;
|
||||
return (day + (13 * m - 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
int ISO8601d::monthOfYear (const std::string& input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue