3#ifdef USE_DATETIME_DATE
10static const char *
const TAG =
"datetime.date_entity";
19 ESP_LOGE(TAG,
"Year must be between 1970 and 3000");
24 ESP_LOGE(TAG,
"Month must be between 1 and 12");
40 if (this->
year_.
has_value() && (this->year_ < 1970 || this->year_ > 3000)) {
41 ESP_LOGE(TAG,
"Year must be between 1970 and 3000");
46 if (this->
month_.
has_value() && (this->month_ < 1 || this->month_ > 12)) {
47 ESP_LOGE(TAG,
"Month must be between 1 and 12");
60 ESP_LOGE(TAG,
"Month must be set to validate day");
70 ESP_LOGE(TAG,
"Year must be set to validate day");
86 ESP_LOGD(TAG,
" Year: %d", *this->
year_);
89 ESP_LOGD(TAG,
" Month: %d", *this->
month_);
92 ESP_LOGD(TAG,
" Day: %d", *this->
day_);
109 ESP_LOGE(TAG,
"Could not convert the date string to an ESPTime object");
const StringRef & get_name() const
constexpr const char * c_str() const
DateCall & set_date(uint16_t year, uint8_t month, uint8_t day)
optional< uint8_t > month_
optional< int16_t > year_
virtual void control(const DateCall &call)=0
CallbackManager< void()> state_callback_
Providing packet encoding functions for exchanging data with a remote host.
uint8_t days_in_month(uint8_t month, uint16_t year)
A more user-friendly version of struct tm from time.h.
static bool strptime(const std::string &time_to_parse, ESPTime &esp_time)
Convert a string to ESPTime struct as specified by the format argument.
uint8_t day_of_month
day of the month [1-31]
uint8_t month
month; january=1 [1-12]
DateCall to_call(DateEntity *date)
void apply(DateEntity *date)