rsence-pre 3.0.0.8 → 3.0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/client/conf/client_pkg.yaml +6 -2
  4. data/client/js/comm/queue/queue.js +32 -44
  5. data/client/js/comm/transporter/transporter.js +24 -16
  6. data/client/js/comm/values/values.js +27 -15
  7. data/client/js/controls/button/button.coffee +14 -5
  8. data/client/js/controls/button/themes/default/button.css +4 -2
  9. data/client/js/controls/checkbox/checkbox.js +4 -4
  10. data/client/js/controls/dialogs/sheet/sheet.js +11 -11
  11. data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
  12. data/client/js/controls/imageview/imageview.js +15 -15
  13. data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
  14. data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
  15. data/client/js/controls/progress/progressbar/progressbar.js +6 -7
  16. data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
  17. data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
  18. data/client/js/controls/sliders/slider/slider.js +74 -79
  19. data/client/js/controls/stepper/stepper.js +31 -31
  20. data/client/js/controls/stringview/stringview.js +20 -8
  21. data/client/js/controls/tab/tab.js +57 -63
  22. data/client/js/controls/tab/themes/default/tab.html +4 -1
  23. data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
  24. data/client/js/controls/validatorview/validatorview.js +4 -4
  25. data/client/js/controls/window/window.js +43 -56
  26. data/client/js/core/class/class.js +25 -23
  27. data/client/js/core/elem/elem.coffee +8 -1
  28. data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
  29. data/client/js/core/util/util_methods/util_methods.coffee +57 -15
  30. data/client/js/datetime/calendar/calendar.coffee +196 -199
  31. data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
  32. data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
  33. data/client/js/datetime/datepicker/datepicker.coffee +18 -3
  34. data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
  35. data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
  36. data/client/js/datetime/momentjs/momentjs.js +310 -76
  37. data/client/js/datetime/timepicker/timepicker.coffee +6 -1
  38. data/client/js/datetime/timesheet/timesheet.js +59 -61
  39. data/client/js/foundation/control/control.js +45 -44
  40. data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
  41. data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
  42. data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
  43. data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
  44. data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
  45. data/client/js/foundation/geom/rect/rect.js +43 -32
  46. data/client/js/foundation/locale_settings/locale_settings.js +36 -25
  47. data/client/js/foundation/system/system.js +79 -67
  48. data/client/js/foundation/thememanager/thememanager.coffee +11 -1
  49. data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
  50. data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
  51. data/client/js/foundation/value/value.js +22 -15
  52. data/client/js/foundation/view/view.js +94 -55
  53. data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
  54. data/client/js/lists/listitems/listitems.js +26 -4
  55. data/client/js/menus/combobox/combobox.coffee +55 -0
  56. data/client/js/menus/minimenu/minimenu.js +61 -30
  57. data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
  58. data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
  59. data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
  60. data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
  61. data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
  62. data/client/js/tables/table/table.coffee +109 -64
  63. data/client/js/tables/table/themes/default/table.css +4 -0
  64. data/lib/rsence/msg.rb +64 -64
  65. data/lib/rsence/plugins/plugin.rb +68 -52
  66. data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
  67. data/lib/rsence/value.rb +79 -59
  68. data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
  69. data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
  70. data/plugins/main/js/main.js +46 -28
  71. metadata +6 -8
  72. data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  73. data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  74. data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  75. data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  76. data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
  77. data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
@@ -1,40 +1,49 @@
1
- .calendar_control {
1
+ .default > .calendar,
2
+ .default > .calendar_bg,
3
+ .default > .calendar > .head,
4
+ .default > .calendar > .head > .prev_month,
5
+ .default > .calendar > .head > .next_month,
6
+ .default > .calendar > .head > .month_year,
7
+ .default > .calendar > .weekdays,
8
+ .default > .calendar > .weekdays > div,
9
+ .default > .calendar > .weeks,
10
+ .default > .calendar > .weeks > .week_row,
11
+ .default > .calendar > .weeks > .week_row > .col_inactive,
12
+ .default > .calendar > .weeks > .week_row > .col_selected,
13
+ .default > .calendar > .weeks > .week_row > .col_wk,
14
+ .default > .calendar > .weeks > .week_row > .col_active,
15
+ .default > .calendar > .weeks > .week_row > .col_today {
2
16
  position: absolute;
3
- left: 0px; top: 0px; right: 0px; bottom: 0px;
17
+ left: 0; top: 0; right: 0; bottom: 0;
4
18
  }
5
- .calendar_head {
6
- position: absolute;
7
- left: 0px; top: 0px; right: 0px; height: 20px;
8
- }
9
- .calendar_head_prev_month,
10
- .calendar_head_next_month {
11
- position: absolute;
12
- top: 2px; width: 16px; height: 16px;
13
- font-size: 0; line-height: 0;
14
- cursor: pointer;
15
- background-image: #{this.getCssFilePath('calendar_arrows.png')};
16
- }
17
- .calendar_head_prev_month {
18
- background-position: 0px 0px;
19
- left: 2px;
20
- }
21
- .calendar_head_next_month {
22
- background-position: -16px 0px;
23
- right: 2px;
24
- }
25
- .calendar_head_prev_month:hover {
26
- background-position: 0px -16px;
27
- }
28
- .calendar_head_next_month:hover {
29
- background-position: -16px -16px;
30
- }
31
- .calendar_head_prev_month:active,
32
- .calendar_head_next_month:active {
33
- background-color: #fff;
19
+
20
+ .default > .calendar > .head { height: 20px; bottom: auto; }
21
+
22
+ .default > .calendar > .head > .prev_month,
23
+ .default > .calendar > .head > .next_month {
24
+ top: 4px; width: 18px; height: 18px; bottom: auto;
25
+ font-size: 18px; line-height: 18px;
26
+ vertical-align: middle; text-align: center;
27
+ cursor: pointer; color: #999;
28
+ }
29
+ .default > .calendar > .head > .prev_month { left: 2px; }
30
+
31
+ .default > .calendar > .head > .prev_month > .flipped {
32
+ transform: scale(-1,1);
33
+ -moz-transform: scale(-1,1);
34
+ -webkit-transform: scale(-1,1);
35
+ display: inline-block;
34
36
  }
35
- .calender_head_month_year {
36
- position: absolute;
37
- top: 0px; left: 20px; right: 20px; height: 20px;
37
+ .default > .calendar > .head > .next_month { right: 2px; left: auto; }
38
+
39
+ .default > .calendar > .head > .prev_month:hover,
40
+ .default > .calendar > .head > .next_month:hover { color: #000; }
41
+
42
+ .default > .calendar > .head > .prev_month:hover,
43
+ .default > .calendar > .head > .next_month:hover { background-color: white; }
44
+
45
+ .default > .calendar > .head > .month_year {
46
+ left: 20px; right: 20px; height: 20px; bottom: auto;
38
47
  color: #000;
39
48
  font-family: Helvetica, Arial, sans-serif;
40
49
  font-weight: normal;
@@ -43,13 +52,10 @@
43
52
  vertical-align: middle;
44
53
  text-align: center;
45
54
  }
46
- .calendar_weekdays {
47
- position: absolute;
48
- top: 20px; left: 0px; right: 0px; height: 15px;
49
- }
50
- .calendar_weekdays div {
51
- position: absolute;
52
- top: 0px; height: 15px; width: 25px;
55
+ .default > .calendar > .weekdays { top: 20px; height: 15px; right: auto; }
56
+
57
+ .default > .calendar > .weekdays > div {
58
+ height: 15px; width: 25px;
53
59
  color: #000;
54
60
  font-family: Helvetica, Arial, sans-serif;
55
61
  font-size: 11px;
@@ -57,141 +63,57 @@
57
63
  vertical-align: middle;
58
64
  text-align: center;
59
65
  }
60
- .calendar_weeks {
61
- position: absolute;
66
+ .default > .calendar > .weeks {
62
67
  top: 34px; left: 0px; right: 2px; bottom: 2px;
63
68
  }
64
- .calendar_weeks_week_row {
65
- position: absolute;
66
- left: 0px; right: 0px;
67
- }
68
- .calendar_weeks_week_col_no,
69
- .calendar_weeks_week_col_sel,
70
- .calendar_weeks_week_col_wk,
71
- .calendar_weeks_week_col_yes,
72
- .calendar_weeks_week_col_today {
73
- position: absolute;
69
+ .default > .calendar > .weeks > .week_row { left: 0px; right: 0px; }
70
+
71
+ .default > .calendar > .weeks > .week_row > .col_inactive,
72
+ .default > .calendar > .weeks > .week_row > .col_selected,
73
+ .default > .calendar > .weeks > .week_row > .col_wk,
74
+ .default > .calendar > .weeks > .week_row > .col_active,
75
+ .default > .calendar > .weeks > .week_row > .col_today {
74
76
  text-decoration: none;
75
- top: 0px;
76
77
  font-family: Helvetica, Arial, sans-serif;
77
78
  font-size: 15px;
78
79
  vertical-align: middle;
79
80
  text-align: center;
80
81
  cursor: pointer;
81
82
  }
82
- .calendar_weeks_week_col_wk {
83
- color: #000;
84
- cursor: default;
85
- }
86
- .calendar_weeks_week_col_no {
87
- color: #666;
88
- }
89
- .enabled > .calendar_control > .calendar_weeks > .calendar_weeks_week_row > .calendar_weeks_week_col_no:hover {
90
- color: #000;
91
- }
92
- .calendar_weeks_week_col_yes,
93
- .calendar_weeks_week_col_sel {
83
+ .default > .calendar > .weeks > .week_row > .col_wk { color: #000; cursor: default; }
84
+
85
+ .default > .calendar > .weeks > .week_row > .col_inactive { color: #666; }
86
+
87
+ .default.enabled > .calendar > .weeks > .week_row > .col_inactive:hover { color: #000; }
88
+
89
+ .default > .calendar > .weeks > .week_row > .col_active,
90
+ .default > .calendar > .weeks > .week_row > .col_selected {
94
91
  color: #000;
95
92
  background-color: #ddd;
96
93
  font-weight: normal;
97
94
  border: 1px solid #666;
98
95
  }
99
- .calendar_weeks_week_col_sel {
100
- background-color: #fff;
101
- }
102
- .calendar_weeks_week_col_today {
103
- font-weight: bold;
104
- color: #F00;
105
- }
106
- .enabled > .calendar_control > .calendar_weeks > .calendar_weeks_week_row > .calendar_weeks_week_col_yes:hover {
96
+ .default > .calendar > .weeks > .week_row > .col_selected { background-color: #fff; }
97
+
98
+ .default > .calendar > .weeks > .week_row > .col_today { font-weight: bold; color: #f00; }
99
+
100
+ .default.enabled > .calendar > .weeks > .week_row > .col_active:hover {
107
101
  border: 2px solid black; margin: -1px; z-index: 100; border-radius: 3px;
108
102
  }
109
- .calendar_bg {
110
- position: absolute;
103
+ .default > .calendar_bg {
111
104
  left: -1px; right: -1px;
112
- top: -1px; bottom: -2px;
113
- }
114
- .calendar_bg * {
115
- position: absolute;
116
- font-size: 0; line-height: 0; /* ie bug work-arounds */
117
- }
118
- .disabled > .calendar_bg *,
119
- .disabled > .calendar_control * {
120
- opacity: 0.8;
121
- }
122
- .calendar_bg .calendar_nw,
123
- .calendar_bg .calendar_n,
124
- .calendar_bg .calendar_ne,
125
- .calendar_bg .calendar_sw,
126
- .calendar_bg .calendar_s,
127
- .calendar_bg .calendar_se {
128
- height: 12px;
129
- background-image: #{this.getCssFilePath('calendar_parts1.png')};
130
- }
131
- .calendar_bg .calendar_c {
132
- left: 12px; right: 12px; top: 12px; bottom: 12px;
133
- background-color: #fbfafb;
134
- /* background-image: #{this.getCssFilePath('calendar_bg.png')};*/
135
- }
136
- .calendar_bg .calendar_w,
137
- .calendar_bg .calendar_e {
138
- top: 12px; bottom: 12px;
139
- width: 12px;
140
- background-image: #{this.getCssFilePath('calendar_parts2.png')};
105
+ top: -1px; bottom: -1px;
106
+ border: 1px solid #e0e0e0;
107
+ border-radius: 3px;
108
+ border-top: 0; border-left: 0;
109
+ box-shadow: 0 0 3px #333;
110
+ #{this.gradientCSS('#fcfcfc',[45,'#ffffff'],[55,'#fdfdfd'],[75,'#f3f3f3'],'#f0f0f0')}
141
111
  }
142
- .calendar_bg .calendar_n,
143
- .calendar_bg .calendar_s {
144
- left: 12px; right: 12px;
112
+ .default.disabled > .calendar_bg *, {
113
+ border-color: #ddd;
114
+ box-shadow: 0 0 3px #666;
115
+ #{this.gradientCSS('#d6d6d6',[66,'#d0d0d0'],[71,'#d3d3d3'],'#cccccc')}
145
116
  }
146
- .calendar_bg .calendar_nw,
147
- .calendar_bg .calendar_ne,
148
- .calendar_bg .calendar_sw,
149
- .calendar_bg .calendar_se {
150
- width: 12px;
117
+ .default.disabled > .calendar * {
118
+ opacity: 0.9;
151
119
  }
152
- .calendar_bg .calendar_nw,
153
- .calendar_bg .calendar_n,
154
- .calendar_bg .calendar_ne {
155
- top: 0px;
156
- }
157
- .calendar_bg .calendar_sw,
158
- .calendar_bg .calendar_s,
159
- .calendar_bg .calendar_se {
160
- bottom: 0px;
161
- }
162
- .calendar_bg .calendar_nw,
163
- .calendar_bg .calendar_w,
164
- .calendar_bg .calendar_sw {
165
- left: 0px;
166
- }
167
- .calendar_bg .calendar_ne,
168
- .calendar_bg .calendar_e,
169
- .calendar_bg .calendar_se {
170
- right: 0px;
171
- }
172
- .calendar_bg .calendar_nw {
173
- background-position: 0px 0px;
174
- }
175
- .calendar_bg .calendar_n {
176
- background-position: 0px -24px;
177
- }
178
- .calendar_bg .calendar_ne {
179
- background-position: -12px 0px;
180
- }
181
- .calendar_bg .calendar_sw {
182
- background-position: 0px -12px;
183
- }
184
- .calendar_bg .calendar_s {
185
- background-position: 0px -36px;
186
- }
187
- .calendar_bg .calendar_se {
188
- background-position: -12px -12px;
189
- }
190
- .calendar_bg .calendar_w {
191
- background-position: 0px 0px;
192
- }
193
- .calendar_bg .calendar_e {
194
- background-position: -12px 0px;
195
- }
196
-
197
-
@@ -1,20 +1,11 @@
1
- <div class="calendar_bg">
2
- <div class="calendar_nw"></div>
3
- <div class="calendar_n"></div>
4
- <div class="calendar_ne"></div>
5
- <div class="calendar_w"></div>
6
- <div class="calendar_c"></div>
7
- <div class="calendar_e"></div>
8
- <div class="calendar_sw"></div>
9
- <div class="calendar_s"></div>
10
- <div class="calendar_se"></div>
11
- </div>
12
- <div class="calendar_control" id="control]I[">
13
- <div class="calendar_head">
14
- <div class="calendar_head_prev_month" id="prevMonth]I["></div>
15
- <div class="calender_head_month_year" id="state]I["></div>
16
- <div class="calendar_head_next_month" id="nextMonth]I["></div>
1
+ <div class="calendar_bg" id="bg]I["></div>
2
+ <div class="calendar" id="control]I[">
3
+ <div class="head">
4
+ <div class="month_year" id="state]I["></div>
5
+ <div class="next_month" id="nextMonth]I[">&#9654;</div>
6
+ <div class="prev_month" id="prevMonth]I["><span class="flipped">&#9654;</span></div>
17
7
  </div>
18
- <div class="calendar_weekdays" id="label]I["></div>
19
- <div class="calendar_weeks" id="value]I["></div>
8
+ <div class="weekdays" id="label]I["></div>
9
+ <div class="weeks" id="value]I["></div>
20
10
  </div>
11
+ ${ELEM.setStyle(this.elemId,'overflow','visible')}
@@ -1,14 +1,28 @@
1
1
  HDatePicker = HTextControl.extend
2
+ defaultEvents: UtilMethods.prototype.cloneObject( HNumberField.prototype.defaultEvents )
2
3
  controlDefaults: HTextControl.prototype.controlDefaults.extend
3
- fieldFormat: 'YYYY-MM-DD'
4
4
  refreshAfter: 3
5
+ useUTC: null
6
+ fieldFormat: null
5
7
  preserveTime: true
6
8
  preserveDate: false
7
9
  calendarPicker: false
8
10
  calendarHorizontalAlign: 'right'
9
11
  calendarVerticalAlign: 'top'
12
+ scrollUnit: 'days'
13
+ customOptions: (_options)->
14
+ _options.useUTC = HLocale.dateTime.defaultOptions.useUTC if _options.useUTC == null
15
+ _options.fieldFormat = HLocale.dateTime.strings.dateFormat if _options.fieldFormat == null
16
+ mouseWheel: (_delta)->
17
+ _date = @moment(@value*1000)
18
+ if _delta > 0
19
+ _date.add(1,@options.scrollUnit)
20
+ else if _delta < 0
21
+ _date.subtract(1,@options.scrollUnit)
22
+ @setValue(_date.unix())
23
+ true
10
24
  valueToField: (_value)->
11
- _date = moment.unix(_value).utc()
25
+ _date = @moment(_value*1000)
12
26
  @_datePreserve = [ _date.year(), _date.month(), _date.date() ] if @options.preserveDate
13
27
  if @options.preserveTime and @_timePreserve? and @calendar? and not @calendar.menuItemView.isHidden
14
28
  @_dateRestore(_date)
@@ -35,7 +49,7 @@ HDatePicker = HTextControl.extend
35
49
  _date.minutes( _minutes )
36
50
  _date.seconds( _seconds )
37
51
  fieldToValue: (_value)->
38
- _date = moment.utc(_value,@options.fieldFormat)
52
+ _date = @moment(_value,@options.fieldFormat)
39
53
  return @value unless _date.isValid()
40
54
  @_dateRestore(_date)
41
55
  _date.unix()
@@ -54,6 +68,7 @@ HDatePicker = HTextControl.extend
54
68
  ).new( [null,0,24,24,1,null], @,
55
69
  value: @value
56
70
  valueObj: @valueObj
71
+ useUTC: @options.useUTC
57
72
  todayStart: @options.todayStart
58
73
  calendarHorizontalAlign: @options.calendarHorizontalAlign
59
74
  calendarVerticalAlign: @options.calendarVerticalAlign
@@ -1,7 +1,12 @@
1
1
  HDateTimePicker = HDatePicker.extend
2
2
  controlDefaults: HDatePicker.prototype.controlDefaults.extend
3
- fieldFormat: 'YYYY-MM-DD HH:mm:ss'
3
+ fieldFormat: null
4
4
  refreshAfter: 3
5
5
  preserveTime: false
6
6
  preserveDate: false
7
7
  calendarPicker: false
8
+ scrollUnit: 'minutes'
9
+ customOptions: (_options)->
10
+ _options.fieldFormat = HLocale.dateTime.strings.dateTimeFormat if _options.fieldFormat == null
11
+ @base(_options)
12
+
@@ -0,0 +1,194 @@
1
+ HDateTime = UtilMethods.extend
2
+
3
+ # constants:
4
+ msWeek: 604800000
5
+ msDay: 86400000
6
+ msHour: 3600000
7
+ msMinute: 60000
8
+
9
+ locale: HLocale.dateTime
10
+ localeStrings: HLocale.dateTime.strings
11
+
12
+ _dateSel: (_date)->
13
+ if _date and _date._d instanceof Date # moment.js
14
+ _zone = _date.zone()
15
+ _date = @moment(_date.unix()*1000).zone(_zone)
16
+ _date = _date.toDate()
17
+ return @date() if @typeChr( _date ) != 'd'
18
+ _date
19
+
20
+ dateInRange: (_date, _min, _max)-> ( _date >= _min and _date < _max )
21
+
22
+ ### = Description
23
+ # Returns month name of the given date.
24
+ #
25
+ # = Parameters
26
+ # +_date+:: Date to return month name from.
27
+ #
28
+ # = Returns
29
+ # Month name
30
+ #
31
+ ###
32
+ monthName: (_date)-> @localeStrings.monthsLong[ @_dateSel(_date).getMonth() ]
33
+
34
+ ### = Description
35
+ # Returns week number for date given as input.
36
+ #
37
+ # = Parameters
38
+ # +_date+:: Date to return week number from.
39
+ #
40
+ # = Returns
41
+ # Number of the week.
42
+ #
43
+ ###
44
+ week: (_date)-> @moment(@_dateSel(_date)).week()
45
+
46
+ ### = Description
47
+ # Returns day of the month for the date given as input.
48
+ #
49
+ # = Parameters
50
+ # +_date+:: Date to return day of the month.
51
+ #
52
+ # = Returns
53
+ # Day of the month
54
+ #
55
+ ###
56
+ mday: (_date)-> @moment( @_dateSel(_date) ).date()
57
+ setMday: (_mday)-> @moment( @date() ).date( _mday ).unix()
58
+
59
+ ### = Description
60
+ # Returns month number for the date given as input.
61
+ # Note that months are numbered from 0 to 11.
62
+ #
63
+ # = Parameters
64
+ # +_date+:: Date to return month number from.
65
+ #
66
+ # = Returns
67
+ # Number of the month 0 (January) to 11 (December).
68
+ #
69
+ ###
70
+ month: (_date)-> @moment( @_dateSel(_date) ).month()
71
+ setMonth: ( _month )-> @moment( @date() ).month( _month ).unix()
72
+
73
+
74
+ ### = Description
75
+ # Returns year for given date.
76
+ #
77
+ # = Parameters
78
+ # +_date+:: Date to return year from.
79
+ #
80
+ # = Returns
81
+ # Year
82
+ #
83
+ ###
84
+ year: (_date)-> @moment( @_dateSel(_date) ).year()
85
+ setYear: ( _year )-> @moment( @date() ).year( _year ).unix()
86
+
87
+ ### = Description
88
+ # Returns the timezone offset in milliseconds.
89
+ #
90
+ # = Parameters
91
+ # +_date+:: The date to get timezone offset from.
92
+ #
93
+ # = Returns
94
+ # Timezone offset in milliseconds.
95
+ #
96
+ ###
97
+ tzMs: (_date)->
98
+ if @typeChr(_date) == 'n'
99
+ _dateDiv = @msNow()/_date
100
+ if _dateDiv > 1000
101
+ _date = @moment(_date)
102
+ else
103
+ _date = @moment(_date*1000)
104
+ _date.zone()*@msMinute
105
+
106
+
107
+ ### = Description
108
+ # Returns a Date instance for epoch given in seconds.
109
+ #
110
+ # = Parameters
111
+ # +_epochSecs+:: Point of time given in seconds
112
+ # since 1 January 1970 00:00:00 UTC.
113
+ #
114
+ # = Returns
115
+ # Date object
116
+ #
117
+ ###
118
+ date: (_epochSecs)->
119
+ if @typeChr(_epochSecs) != 'n'
120
+ _epochSecs = @value
121
+ @moment(_epochSecs*1000).toDate()
122
+
123
+ ### = Description
124
+ # Returns a Date object with first millisecond of the year.
125
+ #
126
+ # = Parameters
127
+ # +_date+:: The date to get the first millisecond of the same year.
128
+ #
129
+ # = Returns
130
+ # The Date object for the first millisecond of the year
131
+ #
132
+ ###
133
+ firstDateOfYear: (_date)-> @moment(@_dateSel(_date)).startOf('year').toDate()
134
+
135
+ ### = Description
136
+ # Get last millisecond of the input given date's year as a Date object.
137
+ #
138
+ # = Parameters
139
+ # +_date+:: The last millisecond of the year on the date given.
140
+ #
141
+ # = Returns
142
+ # Last millisecond of the year as a Date object.
143
+ #
144
+ ###
145
+ lastDateOfYear: (_date)-> @moment(@_dateSel(_date)).endOf('year').toDate()
146
+
147
+ ### = Description
148
+ # Returns the first millisecond of the input given date's month.
149
+ #
150
+ # = Parameters
151
+ # +_date+:: The date to get the first millisecond of the month
152
+ #
153
+ # = Returns
154
+ # The first millisecond on the given date's month as a Date object.
155
+ #
156
+ ###
157
+ firstDateOfMonth: (_date)-> @moment(@_dateSel(_date)).startOf('month').toDate()
158
+
159
+ ### = Description
160
+ # Returns the last millisecond of the input given date's month.
161
+ #
162
+ # = Parameters
163
+ # +_date+:: The date to get the last millisecond of the month.
164
+ #
165
+ # = Returns
166
+ # The last millisecond of the given date's month as a Date object.
167
+ #
168
+ ###
169
+ lastDateOfMonth: (_date)-> @moment(@_dateSel(_date)).endOf('month').toDate()
170
+
171
+ ### = Description
172
+ # Returns the first millisecond when the week starts for date given as input.
173
+ #
174
+ # = Parameters
175
+ # +_date+:: The date to get the first millisecond.
176
+ #
177
+ # = Returns
178
+ # Date for the first millisecond of the week.
179
+ #
180
+ ###
181
+ firstDateOfWeek: (_date)-> @moment(@_dateSel(_date)).startOf('week').toDate()
182
+
183
+ ### = Description
184
+ # Returns the last millisecond of the week for the given date.
185
+ #
186
+ # = Parameters
187
+ # +_date+:: The date to get the last millisecond
188
+ #
189
+ # = Returns
190
+ # The last millisecond of the week as a Date object.
191
+ #
192
+ ###
193
+ lastDateOfWeek: (_date)-> @moment(@_dateSel(_date)).endOf('week').toDate()
194
+