YARN-8592. [UI2] rmip:port/ui2 endpoint shows a blank page in windows OS and Chrome browser. Contributed by Akhil PB.

This commit is contained in:
Sunil G 2018-08-02 16:10:54 +05:30
parent 1ea81169ba
commit 97870ec1f6
1 changed files with 10 additions and 4 deletions

View File

@ -16,12 +16,18 @@
* limitations under the License.
*/
const defaultTz = "America/Los_Angeles";
const getDefaultTimezone = () => {
return moment.tz.guess() || defaultTz;
let timezone = defaultTz;
try {
timezone = moment.tz.guess();
} catch (e) {
console.log(e);
}
return timezone || defaultTz;
};
export const convertTimestampWithTz = (timestamp, format = "YYYY/MM/DD") =>
moment.tz(parseInt(timestamp), getDefaultTimezone()).format(format);
export const convertTimestampWithTz = (timestamp, format = "YYYY/MM/DD") => {
return moment.tz(parseInt(timestamp), getDefaultTimezone()).format(format);
};