rsence-pre 3.0.0.8 → 3.0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/client/conf/client_pkg.yaml +6 -2
- data/client/js/comm/queue/queue.js +32 -44
- data/client/js/comm/transporter/transporter.js +24 -16
- data/client/js/comm/values/values.js +27 -15
- data/client/js/controls/button/button.coffee +14 -5
- data/client/js/controls/button/themes/default/button.css +4 -2
- data/client/js/controls/checkbox/checkbox.js +4 -4
- data/client/js/controls/dialogs/sheet/sheet.js +11 -11
- data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
- data/client/js/controls/imageview/imageview.js +15 -15
- data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
- data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
- data/client/js/controls/progress/progressbar/progressbar.js +6 -7
- data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
- data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
- data/client/js/controls/sliders/slider/slider.js +74 -79
- data/client/js/controls/stepper/stepper.js +31 -31
- data/client/js/controls/stringview/stringview.js +20 -8
- data/client/js/controls/tab/tab.js +57 -63
- data/client/js/controls/tab/themes/default/tab.html +4 -1
- data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
- data/client/js/controls/validatorview/validatorview.js +4 -4
- data/client/js/controls/window/window.js +43 -56
- data/client/js/core/class/class.js +25 -23
- data/client/js/core/elem/elem.coffee +8 -1
- data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
- data/client/js/core/util/util_methods/util_methods.coffee +57 -15
- data/client/js/datetime/calendar/calendar.coffee +196 -199
- data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
- data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
- data/client/js/datetime/datepicker/datepicker.coffee +18 -3
- data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
- data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
- data/client/js/datetime/momentjs/momentjs.js +310 -76
- data/client/js/datetime/timepicker/timepicker.coffee +6 -1
- data/client/js/datetime/timesheet/timesheet.js +59 -61
- data/client/js/foundation/control/control.js +45 -44
- data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
- data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
- data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
- data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
- data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
- data/client/js/foundation/geom/rect/rect.js +43 -32
- data/client/js/foundation/locale_settings/locale_settings.js +36 -25
- data/client/js/foundation/system/system.js +79 -67
- data/client/js/foundation/thememanager/thememanager.coffee +11 -1
- data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
- data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
- data/client/js/foundation/value/value.js +22 -15
- data/client/js/foundation/view/view.js +94 -55
- data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
- data/client/js/lists/listitems/listitems.js +26 -4
- data/client/js/menus/combobox/combobox.coffee +55 -0
- data/client/js/menus/minimenu/minimenu.js +61 -30
- data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
- data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
- data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
- data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
- data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
- data/client/js/tables/table/table.coffee +109 -64
- data/client/js/tables/table/themes/default/table.css +4 -0
- data/lib/rsence/msg.rb +64 -64
- data/lib/rsence/plugins/plugin.rb +68 -52
- data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
- data/lib/rsence/value.rb +79 -59
- data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
- data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
- data/plugins/main/js/main.js +46 -28
- metadata +6 -8
- data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
- data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
- data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsence-pre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Riassence Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rsence-deps
|
@@ -229,18 +229,13 @@ files:
|
|
229
229
|
- client/js/datetime/calendar/calendar.coffee
|
230
230
|
- client/js/datetime/calendar/themes/default/calendar.css
|
231
231
|
- client/js/datetime/calendar/themes/default/calendar.html
|
232
|
-
- client/js/datetime/calendar/themes/default/calendar_arrows.png
|
233
|
-
- client/js/datetime/calendar/themes/default/calendar_bg.png
|
234
|
-
- client/js/datetime/calendar/themes/default/calendar_parts1.png
|
235
|
-
- client/js/datetime/calendar/themes/default/calendar_parts2.png
|
236
232
|
- client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
|
237
233
|
- client/js/datetime/calendar_pulldown/themes/default/calendar_pulldown.css
|
238
234
|
- client/js/datetime/calendar_pulldown/themes/default/calendar_pulldown.html
|
239
235
|
- client/js/datetime/calendar_pulldown/themes/default/calendar_pulldown.png
|
240
236
|
- client/js/datetime/datepicker/datepicker.coffee
|
241
237
|
- client/js/datetime/datetimepicker/datetimepicker.coffee
|
242
|
-
- client/js/datetime/
|
243
|
-
- client/js/datetime/datetimevalue/datetimevalue.js
|
238
|
+
- client/js/datetime/datetimevalue/datetimevalue.coffee
|
244
239
|
- client/js/datetime/momentjs/momentjs.js
|
245
240
|
- client/js/datetime/timepicker/timepicker.coffee
|
246
241
|
- client/js/datetime/timesheet/themes/default/timesheet.css
|
@@ -269,6 +264,8 @@ files:
|
|
269
264
|
- client/js/foundation/locale_settings/locale_settings.js
|
270
265
|
- client/js/foundation/system/system.js
|
271
266
|
- client/js/foundation/thememanager/thememanager.coffee
|
267
|
+
- client/js/foundation/value/pullvalue/pullvalue.coffee
|
268
|
+
- client/js/foundation/value/pushvalue/pushvalue.coffee
|
272
269
|
- client/js/foundation/value/value.js
|
273
270
|
- client/js/foundation/view/morphanimation/morphanimation.js
|
274
271
|
- client/js/foundation/view/view.js
|
@@ -279,6 +276,7 @@ files:
|
|
279
276
|
- client/js/lists/propertylist/propertylist.js
|
280
277
|
- client/js/lists/propertylist/propertylisteditor/propertylisteditor.js
|
281
278
|
- client/js/lists/radiobuttonlist/radiobuttonlist.js
|
279
|
+
- client/js/menus/combobox/combobox.coffee
|
282
280
|
- client/js/menus/menuitem/menuitem.js
|
283
281
|
- client/js/menus/menuitem/themes/default/menuitem.css
|
284
282
|
- client/js/menus/menuitem/themes/default/menuitem.html
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,210 +0,0 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
HDateTimePicker = HControl.extend({
|
4
|
-
setLocked: function(_lockedState){
|
5
|
-
var
|
6
|
-
_enabledState = !_lockedState;
|
7
|
-
this.yyyy.setEnabled(_enabledState);
|
8
|
-
this.mm.setEnabled(_enabledState);
|
9
|
-
this.dd.setEnabled(_enabledState);
|
10
|
-
this.h.setEnabled(_enabledState);
|
11
|
-
this.m.setEnabled(_enabledState);
|
12
|
-
},
|
13
|
-
refreshValue: function(_readMode){
|
14
|
-
if(!this.drawn){
|
15
|
-
return;
|
16
|
-
}
|
17
|
-
if(!this.m){
|
18
|
-
return;
|
19
|
-
}
|
20
|
-
// this.setLocked( HVM.values[ this.options.lockedId ].value );
|
21
|
-
var
|
22
|
-
date = new Date( this.value*1000 ),
|
23
|
-
yyyy = date.getUTCFullYear(),
|
24
|
-
mm = date.getUTCMonth()+1,
|
25
|
-
dd = date.getUTCDate(),
|
26
|
-
h = date.getUTCHours(),
|
27
|
-
m = date.getUTCMinutes();
|
28
|
-
if(_readMode){
|
29
|
-
var
|
30
|
-
nuDate = new Date( this.value*1000 ),
|
31
|
-
doSet = false;
|
32
|
-
if(this.yyyyValue.value !== yyyy){
|
33
|
-
nuDate.setUTCFullYear( this.yyyyValue.value ); doSet = true;
|
34
|
-
}
|
35
|
-
if(this.mmValue.value !== mm){
|
36
|
-
nuDate.setUTCMonth( this.mmValue.value-1 ); doSet = true;
|
37
|
-
}
|
38
|
-
if(this.ddValue.value !== dd){
|
39
|
-
nuDate.setUTCDate( this.ddValue.value ); doSet = true;
|
40
|
-
}
|
41
|
-
if(this.hValue.value !== h){
|
42
|
-
nuDate.setUTCHours( this.hValue.value ); doSet = true;
|
43
|
-
}
|
44
|
-
if(this.mValue.value !== m){
|
45
|
-
nuDate.setUTCMinutes( this.mValue.value ); doSet = true;
|
46
|
-
}
|
47
|
-
if(doSet){
|
48
|
-
this.setValue( nuDate.getTime()/1000 );
|
49
|
-
this.setMonthMax( nuDate );
|
50
|
-
}
|
51
|
-
}
|
52
|
-
else{
|
53
|
-
this.yyyyValue.set( yyyy );
|
54
|
-
this.mmValue.set( mm );
|
55
|
-
this.ddValue.set( dd );
|
56
|
-
this.hValue.set( h );
|
57
|
-
this.mValue.set( m );
|
58
|
-
}
|
59
|
-
},
|
60
|
-
setMonthMax: function( nuDate ){
|
61
|
-
nuDate.setUTCSeconds( 0 );
|
62
|
-
nuDate.setUTCMinutes( 0 );
|
63
|
-
nuDate.setUTCHours( 0 );
|
64
|
-
nuDate.setUTCDate( 1 );
|
65
|
-
var
|
66
|
-
mm = nuDate.getUTCMonth();
|
67
|
-
if(mm === 11){
|
68
|
-
nuDate.setUTCMonth( 0 );
|
69
|
-
nuDate.setUTCFullYear( nuDate.getUTCFullYear()+1 );
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
nuDate.setUTCMonth( mm+1 );
|
73
|
-
}
|
74
|
-
var
|
75
|
-
ms = nuDate.getTime() - 1000,
|
76
|
-
maxDaysDate = new Date(ms),
|
77
|
-
maxDays = maxDaysDate.getUTCDate();
|
78
|
-
// console.log('maxDaysDate:',maxDaysDate.getUTCFullYear(),'-',maxDaysDate.getUTCMonth(),'-',maxDaysDate.getUTCDate());
|
79
|
-
// console.log('maxDays:',maxDays);
|
80
|
-
if(maxDays !== this.dd.numField.options.maxValue){
|
81
|
-
// console.log('reset maxValue..');
|
82
|
-
this.dd.numField.options.maxValue = maxDays;
|
83
|
-
(this.dd.numField.options.maxValue < this.dd.numField.value) && this.ddValue.set( maxDays );
|
84
|
-
this.dd.stepper.options.maxValue = maxDays;
|
85
|
-
}
|
86
|
-
},
|
87
|
-
die: function(){
|
88
|
-
this.yyyyValue.die();
|
89
|
-
this.yyyy.die();
|
90
|
-
this.mmValue.die();
|
91
|
-
this.mm.die();
|
92
|
-
this.ddValue.die();
|
93
|
-
this.dd.die();
|
94
|
-
this.hValue.die();
|
95
|
-
this.h.die();
|
96
|
-
this.mValue.die();
|
97
|
-
this.m.die();
|
98
|
-
this.base();
|
99
|
-
},
|
100
|
-
drawSubviews: function(){
|
101
|
-
ELEM.setStyle( this.elemId, 'overflow', 'visible' );
|
102
|
-
var
|
103
|
-
_NumStepperField = HView.extend({
|
104
|
-
setEnabled: function(_state){
|
105
|
-
this.numField.setEnabled(_state);
|
106
|
-
this.stepper.setEnabled(_state);
|
107
|
-
if(_state){
|
108
|
-
this.stepper.show();
|
109
|
-
}
|
110
|
-
else{
|
111
|
-
this.stepper.hide();
|
112
|
-
}
|
113
|
-
},
|
114
|
-
drawSubviews: function(){
|
115
|
-
ELEM.setStyle( this.elemId, 'overflow', 'visible' );
|
116
|
-
this.numField = HNumericTextControl.extend({
|
117
|
-
refreshValue: function(){
|
118
|
-
this.base();
|
119
|
-
this.parent.parent.refreshValue(true);
|
120
|
-
},
|
121
|
-
textBlur: function(){
|
122
|
-
this.setValue(
|
123
|
-
this.validateText(
|
124
|
-
this.getTextFieldValue()
|
125
|
-
)
|
126
|
-
);
|
127
|
-
}
|
128
|
-
}).nu(
|
129
|
-
[ 0, 0, this.rect.width-10, 21 ],
|
130
|
-
this, {
|
131
|
-
events: {
|
132
|
-
textEnter: false
|
133
|
-
},
|
134
|
-
minValue: this.options.minValue,
|
135
|
-
maxValue: this.options.maxValue,
|
136
|
-
valueObj: this.options.valueObj
|
137
|
-
}
|
138
|
-
);
|
139
|
-
this.stepper = HStepper.nu(
|
140
|
-
[ this.rect.width-15, 0, 15, 21 ],
|
141
|
-
this, {
|
142
|
-
minValue: this.options.minValue,
|
143
|
-
maxValue: this.options.maxValue,
|
144
|
-
valueObj: this.options.valueObj
|
145
|
-
}
|
146
|
-
);
|
147
|
-
}
|
148
|
-
}),
|
149
|
-
_numStepperRect = HRect.nu( 0, 0, 50, 21 );
|
150
|
-
this.yyyyValue = HValue.nu( false, 2010 );
|
151
|
-
this.yyyy = _NumStepperField.nu(
|
152
|
-
HRect.nu( _numStepperRect ),
|
153
|
-
this, {
|
154
|
-
minValue: 2010,
|
155
|
-
maxValue: 2020,
|
156
|
-
valueObj: this.yyyyValue
|
157
|
-
}
|
158
|
-
);
|
159
|
-
_numStepperRect.setWidth( 35 );
|
160
|
-
_numStepperRect.offsetBy( 55, 0 );
|
161
|
-
this.mmValue = HValue.nu( false, 12 );
|
162
|
-
this.mm = _NumStepperField.nu(
|
163
|
-
HRect.nu( _numStepperRect ),
|
164
|
-
this, {
|
165
|
-
minValue: 1,
|
166
|
-
maxValue: 12,
|
167
|
-
valueObj: this.mmValue
|
168
|
-
}
|
169
|
-
);
|
170
|
-
_numStepperRect.offsetBy( 40, 0 );
|
171
|
-
this.ddValue = HValue.nu( false, 24 );
|
172
|
-
this.dd = _NumStepperField.nu(
|
173
|
-
HRect.nu( _numStepperRect ),
|
174
|
-
this, {
|
175
|
-
minValue: 1,
|
176
|
-
maxValue: 31,
|
177
|
-
valueObj: this.ddValue
|
178
|
-
}
|
179
|
-
);
|
180
|
-
_numStepperRect.offsetBy( 50, 0 );
|
181
|
-
this.hValue = HValue.nu( false, 22 );
|
182
|
-
this.h = _NumStepperField.nu(
|
183
|
-
HRect.nu( _numStepperRect ),
|
184
|
-
this, {
|
185
|
-
minValue: 0,
|
186
|
-
maxValue: 23,
|
187
|
-
valueObj: this.hValue
|
188
|
-
}
|
189
|
-
);
|
190
|
-
_numStepperRect.offsetBy( 40, 0 );
|
191
|
-
this.mValue = HValue.nu( false, 45 );
|
192
|
-
this.m = _NumStepperField.nu(
|
193
|
-
HRect.nu( _numStepperRect ),
|
194
|
-
this, {
|
195
|
-
minValue: 0,
|
196
|
-
maxValue: 59,
|
197
|
-
valueObj: this.mValue
|
198
|
-
}
|
199
|
-
);
|
200
|
-
_numStepperRect.offsetBy( 37, 2 );
|
201
|
-
_numStepperRect.setWidth( 60 );
|
202
|
-
HStringView.nu(
|
203
|
-
HRect.nu( _numStepperRect ),
|
204
|
-
this, {
|
205
|
-
// valueObj: HVM.values[this.options.tzValueId]
|
206
|
-
}
|
207
|
-
);
|
208
|
-
this.refreshValue();
|
209
|
-
}
|
210
|
-
});
|
@@ -1,265 +0,0 @@
|
|
1
|
-
|
2
|
-
/*** = Description
|
3
|
-
** Auxiliary class for time handling.
|
4
|
-
***/
|
5
|
-
var//RSence.DateTime
|
6
|
-
HDateTime = HClass.extend({
|
7
|
-
msWeek: 604800000,
|
8
|
-
msDay: 86400000,
|
9
|
-
msHour: 3600000,
|
10
|
-
msMinute: 60000,
|
11
|
-
|
12
|
-
/** = Description
|
13
|
-
* Returns month name of the given date.
|
14
|
-
*
|
15
|
-
* = Parameters
|
16
|
-
* +_date+:: Date to return month name from.
|
17
|
-
*
|
18
|
-
* = Returns
|
19
|
-
* Month name
|
20
|
-
*
|
21
|
-
**/
|
22
|
-
monthName: function(_date){
|
23
|
-
_date = (_date instanceof Date)?_date:this.date();
|
24
|
-
return HLocale.dateTime.strings.monthsLong[_date.getUTCMonth()];
|
25
|
-
},
|
26
|
-
|
27
|
-
/** = Description
|
28
|
-
* Returns week number for date given as input.
|
29
|
-
*
|
30
|
-
* = Parameters
|
31
|
-
* +_date+:: Date to return week number from.
|
32
|
-
*
|
33
|
-
* = Returns
|
34
|
-
* Number of the week.
|
35
|
-
*
|
36
|
-
**/
|
37
|
-
week: function(_date){
|
38
|
-
_date = (_date instanceof Date)?_date:this.date();
|
39
|
-
var _firstDateOfYear = this.firstDateOfYear(_date),
|
40
|
-
_firstWeekOfYear = this.firstDateOfWeek(_firstDateOfYear);
|
41
|
-
if(_firstWeekOfYear.getUTCDate()<=28){
|
42
|
-
_firstWeekOfYear = new Date(_firstWeekOfYear.getTime()+this.msWeek-this.tzMs(_firstWeekOfYear));
|
43
|
-
}
|
44
|
-
var _week = Math.ceil(
|
45
|
-
( ( ( _date.getTime() - _firstWeekOfYear - this.tzMs(_date) ) / this.msDay ) + _firstDateOfYear.getUTCDay() + 1 ) / 7
|
46
|
-
);
|
47
|
-
if((_week === 53) && (this.firstDateOfWeek(this.lastDateOfYear(_date)).getUTCDate() > 28 )){
|
48
|
-
_week = 1;
|
49
|
-
}
|
50
|
-
return _week;
|
51
|
-
},
|
52
|
-
|
53
|
-
/** = Description
|
54
|
-
* Returns day of the month for the date given as input.
|
55
|
-
*
|
56
|
-
* = Parameters
|
57
|
-
* +_date+:: Date to return day of the month.
|
58
|
-
*
|
59
|
-
* = Returns
|
60
|
-
* Day of the month
|
61
|
-
*
|
62
|
-
**/
|
63
|
-
mday: function(_date){
|
64
|
-
_date = (_date instanceof Date)?_date:this.date();
|
65
|
-
return _date.getUTCDate();
|
66
|
-
},
|
67
|
-
|
68
|
-
setMday: function( _mday ){
|
69
|
-
var
|
70
|
-
_date = this.date();
|
71
|
-
_date.setUTCDate( _mday );
|
72
|
-
return Math.round( _date.getTime()/1000 );
|
73
|
-
},
|
74
|
-
|
75
|
-
/** = Description
|
76
|
-
* Returns month number for the date given as input.
|
77
|
-
* Note that months are numbered from 0 to 11.
|
78
|
-
*
|
79
|
-
* = Parameters
|
80
|
-
* +_date+:: Date to return month number from.
|
81
|
-
*
|
82
|
-
* = Returns
|
83
|
-
* Number of the month 0 (January) to 11 (December).
|
84
|
-
*
|
85
|
-
**/
|
86
|
-
month: function(_date){
|
87
|
-
_date = (_date instanceof Date)?_date:this.date();
|
88
|
-
return _date.getUTCMonth();
|
89
|
-
},
|
90
|
-
|
91
|
-
setMonth: function( _month ){
|
92
|
-
var
|
93
|
-
_date = this.date();
|
94
|
-
_date.setUTCMonth( _month );
|
95
|
-
return Math.round( _date.getTime()/1000 );
|
96
|
-
},
|
97
|
-
|
98
|
-
/** = Description
|
99
|
-
* Returns year for given date.
|
100
|
-
*
|
101
|
-
* = Parameters
|
102
|
-
* +_date+:: Date to return year from.
|
103
|
-
*
|
104
|
-
* = Returns
|
105
|
-
* Year
|
106
|
-
*
|
107
|
-
**/
|
108
|
-
year: function(_date){
|
109
|
-
_date = (_date instanceof Date)?_date:this.date();
|
110
|
-
return _date.getUTCFullYear();
|
111
|
-
},
|
112
|
-
|
113
|
-
setYear: function( _year ){
|
114
|
-
var
|
115
|
-
_date = this.date();
|
116
|
-
_date.setUTCFullYear( _year );
|
117
|
-
return Math.round( _date.getTime()/1000 );
|
118
|
-
},
|
119
|
-
|
120
|
-
/** = Description
|
121
|
-
* Returns the timezone offset in milliseconds.
|
122
|
-
*
|
123
|
-
* = Parameters
|
124
|
-
* +_date+:: The date to get timezone offset from.
|
125
|
-
*
|
126
|
-
* = Returns
|
127
|
-
* Timezone offset in milliseconds.
|
128
|
-
*
|
129
|
-
**/
|
130
|
-
tzMs: function(_date){
|
131
|
-
if( typeof _date === 'number' ){
|
132
|
-
var _dateDiv = new Date().getTime()/_date;
|
133
|
-
if( _dateDiv > 1000 ){
|
134
|
-
_date = new Date(_date);
|
135
|
-
}
|
136
|
-
else {
|
137
|
-
_date = new Date(_date*1000);
|
138
|
-
}
|
139
|
-
}
|
140
|
-
return _date.getTimezoneOffset()*this.msMinute;
|
141
|
-
},
|
142
|
-
|
143
|
-
/** = Description
|
144
|
-
* Returns a Date instance for epoch given in seconds.
|
145
|
-
*
|
146
|
-
* = Parameters
|
147
|
-
* +epoch_seconds+:: Point of time given in seconds
|
148
|
-
* since 1 January 1970 00:00:00 UTC.
|
149
|
-
*
|
150
|
-
* = Returns
|
151
|
-
* Date object
|
152
|
-
*
|
153
|
-
**/
|
154
|
-
date: function(epoch_seconds){
|
155
|
-
epoch_seconds = (typeof epoch_seconds === 'number')?epoch_seconds:this.value;
|
156
|
-
var _date = new Date(epoch_seconds*1000);
|
157
|
-
return _date;
|
158
|
-
},
|
159
|
-
|
160
|
-
/** = Description
|
161
|
-
* Returns a Date object with first millisecond of the year.
|
162
|
-
*
|
163
|
-
* = Parameters
|
164
|
-
* +_date+:: The date to get the first millisecond of the same year.
|
165
|
-
*
|
166
|
-
* = Returns
|
167
|
-
* The Date object for the first millisecond of the year
|
168
|
-
*
|
169
|
-
**/
|
170
|
-
firstDateOfYear: function(_date){
|
171
|
-
_date = (_date instanceof Date)?_date:this.date();
|
172
|
-
var _date1 = new Date( _date.getUTCFullYear(), 0, 1 ),
|
173
|
-
_date2 = new Date( _date1.getTime() - this.tzMs(_date1) );
|
174
|
-
return _date2;
|
175
|
-
},
|
176
|
-
|
177
|
-
/** = Description
|
178
|
-
* Get last millisecond of the input given date's year as a Date object.
|
179
|
-
*
|
180
|
-
* = Parameters
|
181
|
-
* +_date+:: The last millisecond of the year on the date given.
|
182
|
-
*
|
183
|
-
* = Returns
|
184
|
-
* Last millisecond of the year as a Date object.
|
185
|
-
*
|
186
|
-
**/
|
187
|
-
lastDateOfYear: function(_date){
|
188
|
-
_date = (_date instanceof Date)?_date:this.date();
|
189
|
-
var _date1 = new Date( new Date( _date.getUTCFullYear()+1, 0, 1 ) - 1 ),
|
190
|
-
_date2 = new Date( _date1.getTime() - this.tzMs(_date1) );
|
191
|
-
return _date2;
|
192
|
-
},
|
193
|
-
|
194
|
-
/** = Description
|
195
|
-
* Returns the first millisecond of the input given date's month.
|
196
|
-
*
|
197
|
-
* = Parameters
|
198
|
-
* +_date+:: The date to get the first millisecond of the month
|
199
|
-
*
|
200
|
-
* = Returns
|
201
|
-
* The first millisecond on the given date's month as a Date object.
|
202
|
-
*
|
203
|
-
**/
|
204
|
-
firstDateOfMonth: function(_date){
|
205
|
-
_date = (_date instanceof Date)?_date:this.date();
|
206
|
-
var _date1 = new Date( _date.getUTCFullYear(), _date.getUTCMonth(), 1 ),
|
207
|
-
_date2 = new Date( _date1.getTime() - this.tzMs(_date1) );
|
208
|
-
return _date2;
|
209
|
-
},
|
210
|
-
|
211
|
-
/** = Description
|
212
|
-
* Returns the last millisecond of the input given date's month.
|
213
|
-
*
|
214
|
-
* = Parameters
|
215
|
-
* +_date+:: The date to get the last millisecond of the month.
|
216
|
-
*
|
217
|
-
* = Returns
|
218
|
-
* The last millisecond of the given date's month as a Date object.
|
219
|
-
*
|
220
|
-
**/
|
221
|
-
lastDateOfMonth: function(_date){
|
222
|
-
_date = (_date instanceof Date)?_date:this.date();
|
223
|
-
var _date1 = new Date( new Date( _date.getUTCFullYear(), _date.getUTCMonth()+1, 1 ) - 1 ),
|
224
|
-
_date2 = new Date( _date1.getTime() - this.tzMs(_date1) );
|
225
|
-
return _date2;
|
226
|
-
},
|
227
|
-
|
228
|
-
/** = Description
|
229
|
-
* Returns the first millisecond when the week starts for date given as input.
|
230
|
-
*
|
231
|
-
* = Parameters
|
232
|
-
* +_date+:: The date to get the first millisecond.
|
233
|
-
*
|
234
|
-
* = Returns
|
235
|
-
* Date for the first millisecond of the week.
|
236
|
-
*
|
237
|
-
**/
|
238
|
-
firstDateOfWeek: function(_date){
|
239
|
-
_date = (_date instanceof Date)?_date:this.date();
|
240
|
-
var _wday = _date.getUTCDay();
|
241
|
-
if(_wday===0){
|
242
|
-
_wday = 7;
|
243
|
-
}
|
244
|
-
var _dateMs = ((_wday-1)*this.msDay),
|
245
|
-
_date1 = new Date( _date.getTime() - _dateMs ),
|
246
|
-
_date2 = new Date( _date1.getTime() );
|
247
|
-
return _date2;
|
248
|
-
},
|
249
|
-
|
250
|
-
/** = Description
|
251
|
-
* Returns the last millisecond of the week for the given date.
|
252
|
-
*
|
253
|
-
* = Parameters
|
254
|
-
* +_date+:: The date to get the last millisecond
|
255
|
-
*
|
256
|
-
* = Returns
|
257
|
-
* The last millisecond of the week as a Date object.
|
258
|
-
*
|
259
|
-
**/
|
260
|
-
lastDateOfWeek: function(_date){
|
261
|
-
var _firstDateOfWeek = this.firstDateOfWeek(_date),
|
262
|
-
_lastDateOfWeek = new Date( _firstDateOfWeek.getTime() + this.msWeek - this.msDay - 1 );
|
263
|
-
return _lastDateOfWeek;
|
264
|
-
}
|
265
|
-
});
|