Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

amam/invalid_time_error #1303

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/trade/tradeDialog.es6
Original file line number Diff line number Diff line change
Expand Up @@ -510,20 +510,20 @@ function init_state(available,root, dialog, symbol, contracts_for_spot){
state.date_expiry.update = function (date_or_hour) {
var expiry = state.date_expiry;
/* contracts that are more not today must end at the market close time */
var is_today = !moment.utc(expiry.value_date).isAfter(moment.utc(),'day');
if(!is_today){
var is_today = !moment.utc(expiry.value_date).isAfter(moment.utc(), 'day');
if (!is_today){
expiry.today_times.disabled = true;
trading_times_for(expiry.value_date, state.proposal.symbol)
.then(function(times){
var value_hour = times.close !== '--' ? times.close : '00:00:00';
var value_hour = times.close !== '--' ? times.close : '23:59:59';
expiry.value_hour = moment(value_hour, "HH:mm:ss").format('HH:mm');
expiry.value = moment.utc(expiry.value_date + " " + value_hour).unix();
state.barriers.update();
debounce(expiry.value, state.proposal.onchange);
});
}
else {
if(date_or_hour !== expiry.value_hour) { expiry.update_times(); }
if (date_or_hour !== expiry.value_hour) { expiry.update_times(); }
expiry.value = moment.utc(expiry.value_date + " " + expiry.value_hour).unix();
state.barriers.update();
debounce(expiry.value, state.proposal.onchange);
Expand Down