anjlab-widgets 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e86ff18469e15a9480df188078c94e2d11f2a18
|
4
|
+
data.tar.gz: d20e9cf5f19176ada909548a569f921b11f10c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc97f393f07f711aa2a84bff401e1a37b038f8759808d96fd7bc1928ade112c95b9baa1b543838ccbc02e7cfb2985f05db5d3faad53bc395e72d7a69ea46aac1
|
7
|
+
data.tar.gz: 8b2b108ab9973329a43e0cc9ed0a25730be5178d7b84726885cdf68f653ec7ea52a8cb1be5812a1a16b27f617a5c7706c5ff4b4b66ae0fa697454a48edf50f5c
|
@@ -143,6 +143,19 @@ DateTools.template = '<div class="datepicker dropdown-menu">'+
|
|
143
143
|
'</div>'+
|
144
144
|
'</div>'
|
145
145
|
|
146
|
+
convertToNative = ($input, options)->
|
147
|
+
value = $input.attr('value')
|
148
|
+
$input.prop("type", "date")
|
149
|
+
if value && value.length > 0
|
150
|
+
locale = options.locale || $input.data('date-locale') || DateTools.getLocale()
|
151
|
+
format = DateTools.parseFormat(options.format || $input.data('date-format') || Locales[locale].dates.format)
|
152
|
+
date = DateTools.parseDate(value, format)
|
153
|
+
value = DateTools.formatDate(date, {
|
154
|
+
separator: '-'
|
155
|
+
parts: ["yyyy", "mm", "dd"]
|
156
|
+
})
|
157
|
+
$input.prop('value', value)
|
158
|
+
|
146
159
|
class NativeRailsDatepicker
|
147
160
|
constructor: (element, options)->
|
148
161
|
@element = $(element)
|
@@ -161,6 +174,9 @@ class NativeRailsDatepicker
|
|
161
174
|
|
162
175
|
@updateRails()
|
163
176
|
|
177
|
+
getISOString: ->
|
178
|
+
@element.val()
|
179
|
+
|
164
180
|
updateRails: ->
|
165
181
|
return if !@rails
|
166
182
|
|
@@ -250,6 +266,12 @@ class Datepicker extends NativeRailsDatepicker
|
|
250
266
|
top: offset.top + @height
|
251
267
|
left: offset.left
|
252
268
|
|
269
|
+
getISOString: ->
|
270
|
+
DateTools.formatDate(@date, {
|
271
|
+
separator: '-'
|
272
|
+
parts: ["yyyy", "mm", "dd"]
|
273
|
+
})
|
274
|
+
|
253
275
|
update: ->
|
254
276
|
@date = DateTools.parseDate(
|
255
277
|
if @isInput then this.element.prop('value') else @element.data('date'),
|
@@ -396,19 +418,6 @@ class Datepicker extends NativeRailsDatepicker
|
|
396
418
|
|
397
419
|
nativePicker = false
|
398
420
|
|
399
|
-
convertToNative = ($input, options)->
|
400
|
-
value = $input.attr('value')
|
401
|
-
$input.prop("type", "date")
|
402
|
-
if value && value.length > 0
|
403
|
-
locale = options.locale || $input.data('date-locale') || DateTools.getLocale()
|
404
|
-
format = DateTools.parseFormat(options.format || $input.data('date-format') || Locales[locale].dates.format);
|
405
|
-
date = DateTools.parseDate(value, format)
|
406
|
-
value = DateTools.formatDate(date, {
|
407
|
-
separator: '-'
|
408
|
-
parts: ["yyyy", "mm", "dd"]
|
409
|
-
})
|
410
|
-
$input.prop('value', value)
|
411
|
-
|
412
421
|
$.fn.datepicker = (option) ->
|
413
422
|
@each ->
|
414
423
|
$this = $(this)
|
@@ -8,7 +8,11 @@
|
|
8
8
|
<input data-widget='datepicker' data-date-allow-blank='false'>
|
9
9
|
|
10
10
|
<script>
|
11
|
+
|
12
|
+
|
11
13
|
$('.js-change').change(function(){
|
12
14
|
console.log($('.js-change').val())
|
15
|
+
var picker = $('.js-change').data('datepicker')
|
16
|
+
console.log(picker.getISOString())
|
13
17
|
})
|
14
18
|
</script>
|