diff options
author | JoramWilander <jwawilander@gmail.com> | 2016-01-04 12:44:22 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2016-01-14 08:24:09 -0500 |
commit | 9110dd54a15f3d0fcf6f60936e01d816b667b93c (patch) | |
tree | be6ddca1c4dc47b71de4c7ad8af59cb21a594b56 /web/react/utils/utils.jsx | |
parent | 53b0cd8f2a24798c67505aa447b1d53b9f14197e (diff) | |
download | chat-9110dd54a15f3d0fcf6f60936e01d816b667b93c.tar.gz chat-9110dd54a15f3d0fcf6f60936e01d816b667b93c.tar.bz2 chat-9110dd54a15f3d0fcf6f60936e01d816b667b93c.zip |
Added license validation and settings
Diffstat (limited to 'web/react/utils/utils.jsx')
-rw-r--r-- | web/react/utils/utils.jsx | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 31bb2ba0b..24042321f 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -201,11 +201,21 @@ export function displayDate(ticks) { return monthNames[d.getMonth()] + ' ' + d.getDate() + ', ' + d.getFullYear(); } -export function displayTime(ticks) { +export function displayTime(ticks, utc) { const d = new Date(ticks); - let hours = d.getHours(); - let minutes = d.getMinutes(); + let hours; + let minutes; let ampm = ''; + let timezone = ''; + + if (utc) { + hours = d.getUTCHours(); + minutes = d.getUTCMinutes(); + timezone = ' UTC'; + } else { + hours = d.getHours(); + minutes = d.getMinutes(); + } if (minutes <= 9) { minutes = '0' + minutes; @@ -224,7 +234,7 @@ export function displayTime(ticks) { } } - return hours + ':' + minutes + ampm; + return hours + ':' + minutes + ampm + timezone; } export function displayDateTime(ticks) { @@ -1301,3 +1311,16 @@ export function fillArray(value, length) { export function isFileTransfer(files) { return files.types != null && (files.types.indexOf ? files.types.indexOf('Files') !== -1 : files.types.contains('application/x-moz-file')); } + +export function clearFileInput(elm) { + // clear file input for all modern browsers + try { + elm.value = ''; + if (elm.value) { + elm.type = 'text'; + elm.type = 'file'; + } + } catch (e) { + // Do nothing + } +} |