signoz/frontend/src/utils/getUserOS.ts
Vikrant Gupta b3bc78d23c
fix: date time value retain on location switch (#4546)
* fix: date time value retain on location switch

* chore: added inline comments

* feat: added shortcut strings based on user os

* feat: added shortcut strings based on user os

* feat: added shortcut strings based on user os
2024-02-14 16:47:39 +05:30

15 lines
401 B
TypeScript

export enum UserOperatingSystem {
WINDOWS = 'Windows',
MACOS = 'Mac OS',
}
export function getUserOperatingSystem(): UserOperatingSystem {
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
if (window.navigator.userAgent.indexOf(UserOperatingSystem.WINDOWS) !== -1) {
return UserOperatingSystem.WINDOWS;
}
// default return is MacOS
return UserOperatingSystem.MACOS;
}