bootstrap-datepicker-rails 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module BootstrapDatepickerRails
2
2
  module Rails
3
- VERSION = "0.6.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
@@ -57,8 +57,23 @@
57
57
  this.autoclose = this.element.data('date-autoclose');
58
58
  }
59
59
 
60
- this.viewMode = 0;
61
- this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
60
+ switch(options.startView){
61
+ case 2:
62
+ case 'decade':
63
+ this.viewMode = this.startViewMode = 2;
64
+ break;
65
+ case 1:
66
+ case 'year':
67
+ this.viewMode = this.startViewMode = 1;
68
+ break;
69
+ case 0:
70
+ case 'month':
71
+ default:
72
+ this.viewMode = this.startViewMode = 0;
73
+ break;
74
+ }
75
+
76
+ this.weekStart = options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0;
62
77
  this.weekEnd = this.weekStart == 0 ? 6 : this.weekStart - 1;
63
78
  this.startDate = -Infinity;
64
79
  this.endDate = Infinity;
@@ -119,7 +134,7 @@
119
134
  hide: function(e){
120
135
  this.picker.hide();
121
136
  $(window).off('resize', this.place);
122
- this.viewMode = 0;
137
+ this.viewMode = this.startViewMode;
123
138
  this.showMode();
124
139
  if (!this.isInput) {
125
140
  $(document).off('mousedown', this.hide);
@@ -538,34 +553,6 @@
538
553
  daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
539
554
  months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
540
555
  monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
541
- },
542
- de: {
543
- days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
544
- daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
545
- daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
546
- months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
547
- monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
548
- },
549
- br: {
550
- days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"],
551
- daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"],
552
- daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"],
553
- months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
554
- monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"]
555
- },
556
- es: {
557
- days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"],
558
- daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
559
- daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"],
560
- months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
561
- monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"]
562
- },
563
- is: {
564
- days: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur", "Sunnudagur"],
565
- daysShort: ["Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau", "Sun"],
566
- daysMin: ["Su", "Má", "Þr", "Mi", "Fi", "Fö", "La", "Su"],
567
- months: ["Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"],
568
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maí", "Jún", "Júl", "Ágú", "Sep", "Okt", "Nóv", "Des"]
569
556
  }
570
557
  }
571
558
 
@@ -592,13 +579,15 @@
592
579
  getDaysInMonth: function (year, month) {
593
580
  return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
594
581
  },
582
+ validParts: /dd?|mm?|MM?|yy(?:yy)?/g,
583
+ nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\r]+/g,
595
584
  parseFormat: function(format){
596
- var separator = format.match(/[.\/ -].*?/),
597
- parts = format.split(/\W+/);
598
- if (!separator || !parts || parts.length == 0){
585
+ var separators = format.split(this.validParts),
586
+ parts = format.match(this.validParts);
587
+ if (!separators || !separators.length || !parts || parts.length == 0){
599
588
  throw new Error("Invalid date format.");
600
589
  }
601
- return {separator: separator, parts: parts};
590
+ return {separators: separators, parts: parts};
602
591
  },
603
592
  parseDate: function(date, format, language) {
604
593
  if (date instanceof Date) return date;
@@ -627,7 +616,7 @@
627
616
  }
628
617
  return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
629
618
  }
630
- var parts = date ? date.split(format.separator) : [],
619
+ var parts = date ? date.match(this.nonpunctuation) : [],
631
620
  date = new Date(),
632
621
  val, filtered;
633
622
  date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
@@ -685,11 +674,14 @@
685
674
  };
686
675
  val.dd = (val.d < 10 ? '0' : '') + val.d;
687
676
  val.mm = (val.m < 10 ? '0' : '') + val.m;
688
- var date = [];
677
+ var date = [],
678
+ seps = $.extend([], format.separators);
689
679
  for (var i=0, cnt = format.parts.length; i < cnt; i++) {
680
+ if (seps.length)
681
+ date.push(seps.shift())
690
682
  date.push(val[format.parts[i]]);
691
683
  }
692
- return date.join(format.separator);
684
+ return date.join('');
693
685
  },
694
686
  headTemplate: '<thead>'+
695
687
  '<tr>'+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-datepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-02 00:00:00.000000000 Z
12
+ date: 2012-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: -1979855553334703762
95
+ hash: 1933958050771925535
96
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
@@ -101,10 +101,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  segments:
103
103
  - 0
104
- hash: -1979855553334703762
104
+ hash: 1933958050771925535
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 1.8.19
107
+ rubygems_version: 1.8.21
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: A date picker for Twitter Bootstrap