سؤال

I am using dhtmlxScheduler with AngularJS, and I'm looking for a way to convert a Date object to a string. I am only concerned with converting the start date, and not the end date in the following app.js code

   '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) };

     });

Any ideas?

هل كانت مفيدة؟

المحلول

If you are only using the string to display on the web page then you can use the date filter

{{ date_expression | date : date : format}}

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top