feat: display feature status (#745)

* feat: display feature status

* fix: hook dep

* fix: react hooks dep
This commit is contained in:
Mo
2021-11-22 11:39:14 -06:00
committed by GitHub
parent 0193eea1f5
commit cf3664751f
10 changed files with 92 additions and 98 deletions

View File

@@ -34,31 +34,6 @@ export function getPlatform(): Platform {
return platformFromString(getPlatformString());
}
let sharedDateFormatter: Intl.DateTimeFormat;
export function dateToLocalizedString(date: Date) {
if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
if (!sharedDateFormatter) {
const locale =
navigator.languages && navigator.languages.length
? navigator.languages[0]
: navigator.language;
sharedDateFormatter = new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'numeric',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
});
}
return sharedDateFormatter.format(date);
} else {
// IE < 11, Safari <= 9.0.
// In English, this generates the string most similar to
// the toLocaleDateString() result above.
return date.toDateString() + ' ' + date.toLocaleTimeString();
}
}
export function isSameDay(dateA: Date, dateB: Date): boolean {
return (
dateA.getFullYear() === dateB.getFullYear() &&