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 97870ec1f6)
This commit is contained in:
Sunil G 2018-08-02 16:10:54 +05:30
parent 35b0686f24
commit b1fcbe7c2d
1 changed files with 10 additions and 4 deletions

View File

@ -16,12 +16,18 @@
* limitations under the License. * limitations under the License.
*/ */
const defaultTz = "America/Los_Angeles"; const defaultTz = "America/Los_Angeles";
const getDefaultTimezone = () => { 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") => export const convertTimestampWithTz = (timestamp, format = "YYYY/MM/DD") => {
moment.tz(parseInt(timestamp), getDefaultTimezone()).format(format); return moment.tz(parseInt(timestamp), getDefaultTimezone()).format(format);
};