mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601d: Added :dayName methods and tests
This commit is contained in:
parent
7164215146
commit
f26cff9a4a
3 changed files with 45 additions and 1 deletions
|
@ -850,6 +850,40 @@ std::string ISO8601d::monthName (int month)
|
|||
return ucFirst (months[month - 1]);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ISO8601d::dayName (int dow, std::string& name)
|
||||
{
|
||||
static const char* days[7] =
|
||||
{
|
||||
STRING_DATE_SUNDAY,
|
||||
STRING_DATE_MONDAY,
|
||||
STRING_DATE_TUESDAY,
|
||||
STRING_DATE_WEDNESDAY,
|
||||
STRING_DATE_THURSDAY,
|
||||
STRING_DATE_FRIDAY,
|
||||
STRING_DATE_SATURDAY,
|
||||
};
|
||||
|
||||
name = ucFirst (days[dow]);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string ISO8601d::dayName (int dow)
|
||||
{
|
||||
static const char* days[7] =
|
||||
{
|
||||
STRING_DATE_SUNDAY,
|
||||
STRING_DATE_MONDAY,
|
||||
STRING_DATE_TUESDAY,
|
||||
STRING_DATE_WEDNESDAY,
|
||||
STRING_DATE_THURSDAY,
|
||||
STRING_DATE_FRIDAY,
|
||||
STRING_DATE_SATURDAY,
|
||||
};
|
||||
|
||||
return ucFirst (days[dow]);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
int ISO8601d::dayOfWeek (const std::string& input)
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
static int daysInMonth (int, int);
|
||||
static int daysInYear (int);
|
||||
static std::string monthName (int);
|
||||
static void dayName (int, std::string&);
|
||||
static std::string dayName (int);
|
||||
|
||||
static int dayOfWeek (const std::string&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue