1

我正在使用jquery 甘特图,我的日期是错误的。示例:我在第 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>

有什么好解释的,谢谢!!

4

1 回答 1

0

我知道了!

我只是在我的控制器中转换 to_time 和 to_i 并完成!:)

于 2013-07-31T19:02:19.947 回答