gpt4 book ai didi

javascript - 使用 jquery.Gantt 并返回错误的日期

转载 作者:行者123 更新时间:2023-11-28 08:59:26 25 4
gpt4 key购买 nike

我正在使用jquery gantt而且我的日期是错误的。示例:我在第 18 天注册,但我的结果却多了 1 天。登记第 19 天,我的结果是 20。我做了什么?我不知道:/

我的代码:

<script>

$(function() {

"use strict";

var today = moment();
var andTwoHours = moment().add("hours",2);
var today_friendly = "/Date(" + today.valueOf() + ")/";
var next_friendly = "/Date(" + andTwoHours.valueOf() + ")/";
var today_friendly = today.toDate();
var next_friendly = andTwoHours.toDate();
var maxDate = moment().add("days",10).toDate();

$('.gantt').gantt({
source: [{
name: '<%= raw @mapa[:tasks][0][:descricao] %>',
desc: '<%= raw @mapa[:tasks][0][:status] %>'+"% concluído",
values: [{
from: "/Date(<%= raw @mapa[:tasks][0][:data_inicial] %>)/",
to: "/Date(<%= raw @mapa[:tasks][0][:data_final] %>)/",
//from:today_friendly,
//to:next_friendly,
label:"<%= raw @mapa[:tasks][0][:descricao] %>",
customClass: "ganttRed"
}]
}],
maxScale:"months",
navigate: "scroll",
waitText: "Aguarde...",
dow: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]
});

});

</script>

任何我解释得更好的东西,谢谢!!

最佳答案

我明白了!

我只需在 Controller 中转换 to_time 和 to_i 即可完成! :)

关于javascript - 使用 jquery.Gantt 并返回错误的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17948583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com