Patch level : 12.0 no-patch

Files correlati     :
Commento            :

Aggiunte funzioni per inizio e fine anno
This commit is contained in:
Alessandro Bonazzi 2020-07-26 09:48:13 +02:00
parent 0a199bb95b
commit 00b00f9650
2 changed files with 12 additions and 18 deletions

View File

@ -130,21 +130,6 @@ int TDate::last_day(int month, int year)
return d;
}
void TDate::set_end_month()
{
_val = makedata(last_day(month(),year()),month(),year());
}
bool TDate::is_end_month() const
{
return day() == last_day(month(),year());
}
bool TDate::empty() const
{
return _val == 0;
}
int TDate::wday() const
{
// day of week (1=lunedi)

View File

@ -110,11 +110,20 @@ public:
// @cmember Ritorna l'ultimo giorno possibile del mese
static int last_day(int month, int year);
// @cmember Controlla se il giorno e' l'ultimo del mese
bool is_end_month() const;
bool is_end_month() const { return day() == last_day(month(), year());}
// @cmember Setta il giorno del mese all'ultimo possibile
void set_end_month();
void set_end_month() { _val = makedata(last_day(month(), year()), month(), year());}
// @cmember Controlla se il giorno e' primo dell'anno
bool is_start_year() const { return day() == 1 && month() == 1; }
// @cmember Setta il primo giorno dell'anno
void set_start_year(int y = 0) { _val = makedata(1, 1, y == 0 ? year() : y); }
// @cmember Controlla se il giorno e' l'ultimo dell'anno
bool is_end_year() const { return day() == 31 && month() == 12; }
// @cmember Setta l'ultimo giorno dell'anno
void set_end_year(int y = 0) { _val = makedata(31, 12, y == 0 ? year() : y); }
// @cmember Controlla se la data è nulla
bool empty() const ;
bool empty() const { return _val == 0;}
// @cmember Setta la il giorno
void set_day(int n);