mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
fix start/end epoch times
This commit is contained in:
parent
8d7a5ac5da
commit
db8433b9c7
1 changed files with 12 additions and 7 deletions
19
index.html
19
index.html
|
@ -17,10 +17,10 @@
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var opts = { dateFormat: "@" }; // unix date format
|
var opts = { dateFormat: $.datepicker.ISO_8601 };
|
||||||
|
|
||||||
$('#start_epoch').datepicker(opts);
|
$('#start_epoch').datepicker(opts, 'getdate');
|
||||||
$('#end_epoch').datepicker(opts);
|
$('#end_epoch').datepicker(opts, 'getdate');
|
||||||
|
|
||||||
$('#dataHex').click(function() {
|
$('#dataHex').click(function() {
|
||||||
copyToClipboard($(this).attr('id'));
|
copyToClipboard($(this).attr('id'));
|
||||||
|
@ -38,13 +38,18 @@
|
||||||
|
|
||||||
var gov = new Bitcore.GovObject.Proposal();
|
var gov = new Bitcore.GovObject.Proposal();
|
||||||
|
|
||||||
gov.end_epoch = document.getElementById('end_epoch').value || null;
|
// proposal basic fields
|
||||||
|
gov.name = document.getElementById('name').value;
|
||||||
|
gov.url = document.getElementById('url').value;
|
||||||
gov.payment_address = document.getElementById('payment_address').value;
|
gov.payment_address = document.getElementById('payment_address').value;
|
||||||
gov.payment_amount = parseFloat(document.getElementById('payment_amount').value);
|
gov.payment_amount = parseFloat(document.getElementById('payment_amount').value);
|
||||||
gov.name = document.getElementById('name').value;
|
|
||||||
gov.start_epoch = document.getElementById('start_epoch').value || null;
|
// format dates for gobject serialization
|
||||||
|
gov.start_epoch = (new Date(document.getElementById('start_epoch').value) / 1000) || null;
|
||||||
|
gov.end_epoch = (new Date(document.getElementById('end_epoch').value) / 1000) || null;
|
||||||
|
|
||||||
|
// hidden elements
|
||||||
gov.type = parseInt(document.getElementById('type').value);
|
gov.type = parseInt(document.getElementById('type').value);
|
||||||
gov.url = document.getElementById('url').value;
|
|
||||||
|
|
||||||
document.getElementById('dataHex').innerHTML = gov.uncheckedSerialize();
|
document.getElementById('dataHex').innerHTML = gov.uncheckedSerialize();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue