本文整理汇总了TypeScript中entcore.moment函数的典型用法代码示例。如果您正苦于以下问题:TypeScript moment函数的具体用法?TypeScript moment怎么用?TypeScript moment使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了moment函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
link: (scope:any) => {
// Get data
scope.subjectCopyList = [];
SubjectCopyService.resolve(false).then(
function () {
scope.subjectCopyList = SubjectCopyService.getList();
}
);
SubjectScheduledService.resolve(false).then(
function(){
}
);
// Date
scope.today = new Date();
scope.dateInAWeek = moment().startOf('week').add(1, 'week').toDate();
scope.dateInAYears = moment().add(1, 'year').toDate();
// Search
if (!scope.search) {
scope.search = {
beginDate: moment().startOf('week').add(1, 'week').toDate(),
endDate: moment().add(3, 'month').toDate()
}
}
}
示例2: function
scope.modifySchedule = function () {
var subjectScheduled = {
id:scope.selectedSubjectScheduled.id,
begin_date:moment(scope.option.begin_date).hours(14).minutes(0).seconds(0)
.toISOString().replace(/T..:../, "T"+scope.option.begin_time),
due_date:moment(scope.option.due_date).hours(14).minutes(0).seconds(0)
.toISOString().replace(/T..:../, "T"+scope.option.due_time)
};
SubjectScheduledService.modifySchedule(subjectScheduled).then(
function() {
window.location.reload();
},
function(err) {
notify.error(err);
}
);
}
示例3: async
$scope.saveDraft = async (item) => {
try {
await Conversation.instance.folders.draft.saveDraft(item);
$scope.state.draftError = false;
$scope.state.draftSaveDate = moment();
}
catch (e) {
$scope.state.draftError = true;
}
};
示例4: function
scope.order.order = function(item){
if(scope.order.field === 'submitted_date' && item.submitted_date){
return moment(item.submitted_date);
}
if(scope.order.field.indexOf('.') >= 0){
var splitted_field = scope.order.field.split('.')
var sortValue = item
for(var i = 0; i < splitted_field.length; i++){
sortValue = (typeof sortValue === 'undefined' || sortValue === null) ? undefined : sortValue[splitted_field[i]]
}
return sortValue
} else
return (item[scope.order.field]) ? item[scope.order.field] : undefined;
};
示例5: function
directory.User.prototype.saveAccount = function(cb){
var accountData = {
lastName : this.lastName,
firstName: this.firstName,
type: this.type,
birthDate: moment(this.birthDate).format('YYYY-MM-DD')
} as any;
if(this.type === 'Relative'){
accountData.childrenIds = _.map(this.relatives, function(user){
return user.id;
});
}
oldHttp().postJson('/directory/class/' + model.me.preferences.selectedClass + '/user', accountData).done(function(data){
this.updateData(data);
if(typeof cb === 'function'){
cb();
}
}.bind(this));
};
示例6: function
$scope.longDate = function(dateString){
return moment(dateString).format('DD MMMM YYYY')
};
示例7: moment
link: (scope:any) => {
scope.search = {
groupList: [],
beginDate: moment().subtract(3, 'month').toDate(),
endDate: moment().add(3, 'month').toDate(),
};
scope.selectedSubjectsScheduled=[];
scope.getSubjectScheduledPicture = function (subjectScheduled) {
return subjectScheduled.picture || skin.basePath + 'img/illustrations/image-default.svg';
};
scope.filterOnSubjectScheduledDueDate = function (begin, end) {
return function (subjectScheduled) {
var dueDate = DateService.isoToDate(subjectScheduled.due_date);
if (!begin || !end) {
throw "begin or end date in params missing"
}
return DateService.compare_after(dueDate, begin, true) && DateService.compare_after(end, dueDate, true);
}
};
scope.orderByCopyListModificationDate = function(id){
var copyList = ArchivesService.getSubjectScheduledCopyById(id);
var lastUpdateCopy:any = null;
angular.forEach(copyList, function(copy){
if(lastUpdateCopy){
if(DateService.compare_after(DateService.isoToDate(copy.modified), DateService.isoToDate(lastUpdateCopy))){
lastUpdateCopy = copy;
}
} else{
lastUpdateCopy = copy;
}
});
if(lastUpdateCopy != null && lastUpdateCopy.modified != null){
return lastUpdateCopy.modified;
}
}
scope.selectsubjectScheduled = function(subjectScheduled){
if(subjectScheduled.selected){
scope.selectedSubjectsScheduled.push(subjectScheduled);
}else{
scope.selectedSubjectsScheduled.pop(subjectScheduled);
}
}
scope.clickOnSubjectScheduled = function(subjectScheduled){
scope.selectedSubjectScheduled = subjectScheduled;
$location.path('/dashboard/teacher/archive/'+subjectScheduled.id);
};
scope.exportAll = function(){
exportCSV(scope.subjectScheduledList);
};
scope.exportSelected = function(){
exportCSV(scope.selectedSubjectsScheduled);
}
function exportCSV(subjects:ISubjectScheduled[]) {
var ids:string = "?"
subjects.forEach((subject) =>{
ids = ids.concat("id="+subject.id+"&");
} );
window.location.href = '/exercizer/archive/subjects-scheduled/export-csv' + ids.slice(0,-1);
}
}
示例8: moment
Birthday.birthdays = Birthday.birthdays.sort(function(a, b){
return moment(a.birthDate).date() - moment(b.birthDate).date()
});