~pkunal-parmar/ubuntu-calendar-app/ICalImport

« back to all changes in this revision

Viewing changes to dateExt.js

  • Committer: Launchpad Translations on behalf of ubuntu-calendar-dev
  • Date: 2014-06-09 06:30:09 UTC
  • Revision ID: launchpad_translations_on_behalf_of_ubuntu-calendar-dev-20140609063009-vf9c9x0iyl0ossr6
Launchpad automatic translations update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    return date
36
36
}
37
37
 
 
38
Date.prototype.endOfDay = function() {
 
39
    var date = new Date(this)
 
40
    date.setHours(23,59,59,0);
 
41
    return date
 
42
}
 
43
 
38
44
Date.prototype.addDays = function(days) {
39
45
    var date = new Date(this)
40
 
    date.setTime(date.getTime() + Date.msPerDay * days)
 
46
    date.setDate(date.getDate() + days);
41
47
    return date
42
48
}
43
49
 
84
90
    && this.getFullYear() === otherDay.getFullYear() );
85
91
}
86
92
 
 
93
Date.prototype.mergeDate = function (d) {
 
94
    this.setFullYear(d.getFullYear());
 
95
    this.setMonth(d.getMonth());
 
96
    this.setDate(d.getDate());
 
97
}
 
98
 
87
99
function weekCount(year, month_number) {
88
100
    var firstOfMonth = new Date(year, month_number, 1);
89
101
    var lastOfMonth = new Date(year, month_number+1, 0);
98
110
    var first = date.getDate() - date.getDay();
99
111
    return new Date(date.setDate(first));
100
112
}
 
113
 
 
114
function today() {
 
115
    var date = new Date();
 
116
    date.setHours(0,0,0,0);
 
117
    return date
 
118
}
 
119
 
 
120
function isSameMonth(date1, date2) {
 
121
    return ( date1.getFullYear() === date2.getFullYear()
 
122
            && date1.getMonth() === date2.getMonth() )
 
123
}