0
DATEPICKERをクリックして私の質問を理解してください。 日付がこの形式で表示される形式は「d-d M yyyy」です。 EditText(画像DATEPICKER)に示されている日付は、「2016年5月18-18日」です。 しかし、私はそれを「18-21 May 2016」としたいと思います。ですから、「2016年5月18-21日」と日付を表示する方法(形式)はありますか?日付を日付範囲の形式で表示する
私は以下のリンクを持つブートストラップのdatepickerを使用しています。
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/css/bootstrap-datepicker3.min.css" rel="stylesheet">
私はこの日付ピッカーに与えているいくつかのデフォルトのオプションは、私は次のように日付のセッター・ディレクティブを使用しています、また
autoclose: true,
todayHighlight: true,
clearBtn: true
format: 'd-d M yyyy',
です。
app.directive('dateSetter', function(){
return {
restrict: 'A',
require: '?ngModel',
link: function(scope, element, attrs, ctrl){
ctrl.$parsers.push(function (value) {
if (!!value)
return moment(value).format("YYYY-MM-DD");
else
return null;
});
ctrl.$formatters.push(function (value) {
if (!!value) {
return moment(value).format('ddd D MMM YYYY');
}
else
return null;
});
}
}
});
に日付形式のためhttps://docs.angularjs.org/api/ng/filter/dateを参照してください。これはフォーマット上の問題ではなく、開始日を格納する変数と終了日を格納する変数の2つの変数が必要です。 – Claies