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: d6393b9f5ad7b950a29d3151d851e42540a864c9
4
- data.tar.gz: 3f7dc68afdcfb6b1fdfabde911b05c54cfb9b7f4
3
+ metadata.gz: 2e86ff18469e15a9480df188078c94e2d11f2a18
4
+ data.tar.gz: d20e9cf5f19176ada909548a569f921b11f10c03
5
5
  SHA512:
6
- metadata.gz: 51c79a86372996f405c4eead5357977affa86799e610cdbd540c5b06b2bc9bb58c3b8118413c2c4e45bb03d907bad0d62a5f1bacc09b911157d0e16c81978613
7
- data.tar.gz: 576185d97277e09b32b2292612dfb1a77495aa89481fc65140f5d2abc0ce156709840be65f26b703e9971632f6b7c8e0b3ee7f09e7822bda708c4d07f5fdf58b
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)
@@ -1,5 +1,5 @@
1
1
  module Anjlab
2
2
  module Widgets
3
- VERSION = "1.0.9"
3
+ VERSION = "1.0.10"
4
4
  end
5
5
  end
@@ -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>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anjlab-widgets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Korolev