0

我正在将 dhtmlxScheduler 与 AngularJS 一起使用,并且我正在寻找一种将 Date 对象转换为字符串的方法。我只关心在下面的 app.js 代码中转换开始日期,而不是结束日期

   'use strict';

    /* App Module */

    var app = angular.module('schedulerApp', [ ]);

    app.controller('MainSchedulerCtrl', function($scope) {


     $scope.events = [
        { 
          id:1, text:"Task A-12458",

          start_date: new Date(2013, 3, 12), // How would I store this date in a string?

          end_date: new Date(2013, 3, 14) },

     ];

     $scope.scheduler = { date : new Date(2013,10,1) };

     });

有任何想法吗?

4

1 回答 1

1

如果您只使用字符串显示在网页上,那么您可以使用日期过滤器

{{ 日期表达式 | 日期:日期:格式}}

于 2014-03-07T19:46:09.197 回答