angular.js - How to set the angular datepicker to display the time of a certain month when it appears
大家讲道理
大家讲道理 2017-05-15 17:01:26
0
3
739

How to set the datepicker to display the date of a certain month as soon as it appears, such as February 2012, April 2018, etc.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
Ty80

Just give a default value in ng-model

刘奇

Look at whether your component accepts a formatted string or a DATE string, and then assign a value to ng-model.
Because different date components may receive different values, to avoid the possibility that if you fill in a value, the component cannot recognize it, and then there will be a bug when the date component pops up.

某草草

Assign default time

function Format(date,type) 
      { 
        var new_date;
        var year  = date.getFullYear();
        var month = date.getMonth()+1;
        var day   = date.getDate();

        if (day>0 && day<10) {
          day = '0'+day;
        }

        if (month>0 && month<10) {
          month = '0'+month;
        }

        switch(type) {
          case 1:
            new_date  = year+'-'+month+'-'+day;
            break;
          case 2:
            new_date  = year+'-'+month+'-'+(day-6);
            break;
        }
        
        return new_date; 
      }
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template