mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 08:17:59 +00:00
Added Utils.js, for miscellaneous Javascript functions
This commit is contained in:
parent
7fe9d71eb3
commit
75ccc7a31b
2 changed files with 27 additions and 0 deletions
25
js/Utils.js
Normal file
25
js/Utils.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/**
|
||||||
|
* Formats a date.
|
||||||
|
* @param {date} date - toggle decorations
|
||||||
|
* @param {params} params -
|
||||||
|
*/
|
||||||
|
function formatDate( date, params ) {
|
||||||
|
var options = {
|
||||||
|
weekday: "short",
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
timeZone: "UTC",
|
||||||
|
timeZoneName: "short",
|
||||||
|
};
|
||||||
|
|
||||||
|
options = [options, params].reduce(function (r, o) {
|
||||||
|
Object.keys(o).forEach(function (k) { r[k] = o[k]; });
|
||||||
|
return r;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
|
||||||
|
return new Date( date ).toLocaleString( 'en-US', options );
|
||||||
|
}
|
2
qml.qrc
2
qml.qrc
|
@ -206,5 +206,7 @@
|
||||||
<file>images/warning.png</file>
|
<file>images/warning.png</file>
|
||||||
<file>images/checkedBlackIcon.png</file>
|
<file>images/checkedBlackIcon.png</file>
|
||||||
<file>images/rightArrowInactive.png</file>
|
<file>images/rightArrowInactive.png</file>
|
||||||
|
<file>js/Windows.js</file>
|
||||||
|
<file>js/Utils.js</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Reference in a new issue