* quick and dirty WIP to investigate timezones, currently only building under esp8266 platform much of the status stuff has been stripped for now, to test the concepts * support set of common features across ESP32/ESP8266 WRT timezone and sntp return dates as ISO format strings * remove time library, and timelib fix which is no longer required * fix the icons * remove temporary changes to demo project
29 lines
641 B
JavaScript
29 lines
641 B
JavaScript
import * as Highlight from '../constants/Highlight';
|
|
|
|
export const NTP_INACTIVE = 0;
|
|
export const NTP_ACTIVE = 1;
|
|
|
|
export const isNtpActive = ntpStatus => ntpStatus && ntpStatus.status === NTP_ACTIVE;
|
|
|
|
export const ntpStatusHighlight = ntpStatus => {
|
|
switch (ntpStatus.status) {
|
|
case NTP_INACTIVE:
|
|
return Highlight.IDLE;
|
|
case NTP_ACTIVE:
|
|
return Highlight.SUCCESS;
|
|
default:
|
|
return Highlight.ERROR;
|
|
}
|
|
}
|
|
|
|
export const ntpStatus = ntpStatus => {
|
|
switch (ntpStatus.status) {
|
|
case NTP_INACTIVE:
|
|
return "Inactive";
|
|
case NTP_ACTIVE:
|
|
return "Active";
|
|
default:
|
|
return "Unknown";
|
|
}
|
|
}
|