From b1fcbe7c2db0ccc3dfab0758c618df38d932381c Mon Sep 17 00:00:00 2001 From: Sunil G Date: Thu, 2 Aug 2018 16:10:54 +0530 Subject: [PATCH] YARN-8592. [UI2] rmip:port/ui2 endpoint shows a blank page in windows OS and Chrome browser. Contributed by Akhil PB. (cherry picked from commit 97870ec1f6e40ee863333f29411d71b6c687bbed) --- .../src/main/webapp/app/utils/date-utils.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/date-utils.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/date-utils.js index 6a9780c18c3..4abdc7219df 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/date-utils.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/date-utils.js @@ -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); +};