mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-05 05:34:27 +02:00
Updated Examples and Recipes (markdown)
@@ -1356,18 +1356,18 @@ First the code, and then a detailed explanation:
|
||||
{
|
||||
case 0:
|
||||
// Output month and year title
|
||||
os << left << setw(21) << format(os.getloc(), " %B %Y", sys_days{ym/1}) << right;
|
||||
os << left << setw(21) << format(os.getloc(), " %B %Y", ym) << right;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
// Output weekday names title
|
||||
auto sd = sys_days{ym/firstdow[1]};
|
||||
for (auto const esd = sd + weeks{1}; sd < esd; sd += days{1})
|
||||
auto wd = first dow;
|
||||
do
|
||||
{
|
||||
auto d = format(os.getloc(), "%a", sd);
|
||||
auto d = format(os.getloc(), "%a", wd);
|
||||
d.resize(2);
|
||||
os << ' ' << d;
|
||||
}
|
||||
} while (++wd != firstdow);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
@@ -1378,7 +1378,7 @@ First the code, and then a detailed explanation:
|
||||
auto d = 1_d;
|
||||
do
|
||||
{
|
||||
os << setw(3) << unsigned(d);
|
||||
os << format(" %e", d);
|
||||
++d;
|
||||
} while (++wd != firstdow);
|
||||
break;
|
||||
@@ -1399,7 +1399,7 @@ First the code, and then a detailed explanation:
|
||||
auto wd = firstdow;
|
||||
do
|
||||
{
|
||||
os << setw(3) << unsigned(d);
|
||||
os << format(" %e", d);
|
||||
} while (++wd != firstdow && ++d <= e);
|
||||
// Append row with spaces if the week did not complete
|
||||
os << string(static_cast<unsigned>((firstdow-wd).count())*3, ' ');
|
||||
|
Reference in New Issue
Block a user