0
次の四半期の結果を返すように、次の四半期の時間を追加したいと思います。追加jQueryの次の四半期の時間
例:
9時04分AMが戻ってくる22:45
10時46分午後を返す午前9時30分
22:40を返します9:15
9:15を返す午後11時
は、ここに私のコードです:
<script src="https://cdn.jsdelivr.net/handlebarsjs/4.0.5/handlebars.min.js"></script>
<script>
/*
* Top of Hour Code
*/
$(function() {
var wt_regex = new RegExp("\\{\\{webinar_time\\}\\}","g");
var wt_formatted = moment().add(1, 'hour').startOf('hour').format('h:mm A');
var $source = $('[data-title="cftoh-time"]').html();
var template = Handlebars.compile($source);
var data = {
"webinar_time": wt_formatted
}
var html = template(data);
$('[data-title="cftoh-time"]').html(html);
$.countdown.setDefaults($.countdown.regionalOptions["eng"]);
var newClasses = $('[data-title="cftoh-countdown"] div').first().attr("class");
var currClasses = $('[data-title="cftoh-countdown"]').attr("class");
top_hour_time = moment().add(1, 'hour').startOf('hour').unix();
time_now = moment().unix();
time_now_diff_seconds = top_hour_time - time_now;
$('[data-title="cftoh-countdown"]').countdown({
until: time_now_diff_seconds,
padZeroes: true,
}).attr("class",newClasses).wrap('<div class="'+currClasses+'"></div>');
setWebinarTime();
// set value of webinar
$('[href="#submit-form"]').on('click', function() {
setWebinarTime();
});
function setWebinarTime() {
$webinar_dt = moment().add(1, 'hour').startOf('hour');
$("#webinar_delay").val($webinar_dt.diff(moment()));
}
});
</script>
あなたは、私は非常に新しいINITよ、私は私が行うことができますどのように知らせてくださいすることができます。
コードが実行されたときまたはリンクがクリックされた時点の現在時刻が何時間後であっても、あなたは、例の入力値(9:04など)がどこから来ているかを明確にしていません。表示されているコードのうち、四半期の問題に関連するコードの量はどれくらいですか? – nnnnnn
@nnnnnnはい、私は現在の時間が何であっても、次の四半期後にしたいです。 –