Skip to content

Commit 0b063b4

Browse files
committed
Merge pull request #22 from alfredobarron/dev
Se actualizo a la version 2.0.4
2 parents a2af281 + 60c4cae commit 0b063b4

File tree

7 files changed

+58
-65
lines changed

7 files changed

+58
-65
lines changed

getting-started.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ <h1>Primeros pasos</h1>
8080
<section id="download-smoke">
8181
<h1>Descargar Smoke</h1><hr>
8282
<p class="lead">Descarga Smoke y agregalo a tu proyecto, usarlo es fácil y rápido.</p>
83-
<p><a class="btn btn-default btn-lg" role="button" href="https://github.com/alfredobarron/smoke/releases/download/v2.0.3/smoke-v2.0.3.zip" target="_blank">Descargar Smoke</a></p>
83+
<p><a class="btn btn-default btn-lg" role="button" href="https://github.com/alfredobarron/smoke/releases/download/v2.0.4/smoke-v2.0.4.zip" target="_blank">Descargar Smoke</a></p>
8484
</section>
8585

8686
<section id="whats-included">

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ <h1>SMOKE</h1>
6060

6161
<p class="lead">Jquery Plugin diseñado para usarse en Bootstrap 3<br>Validación de formularios, Notificaciones, Alertas, Mensajes de Confirmación, Barra de progreso y Mas</p>
6262

63-
<p><a class="btn btn-default btn-lg smk-transition1" role="button" href="getting-started.html">Descargar Smoke v2.0.3</a></p>
63+
<p><a class="btn btn-default btn-lg smk-transition1" role="button" href="getting-started.html">Descargar Smoke v2.0.4</a></p>
6464

6565
</div><!-- /.container -->
6666
</div>

smoke-v2.0.3.zip

-15 KB
Binary file not shown.

smoke-v2.0.4.zip

15.1 KB
Binary file not shown.

smoke/css/smoke.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ input[type=number]::-webkit-outer-spin-button {
164164
margin: 0;
165165
}
166166

167+
168+
/*
169+
|---------------------------------------------------------------------
170+
| Al agregar padding a un div evita que su tamaño crezca
171+
|---------------------------------------------------------------------
172+
*/
173+
.smk-sizing{
174+
box-sizing: border-box;
175+
}
176+
177+
167178
/* Transition */
168179
.smk-transition1 {
169180
transition: all .2s ease-in-out;

smoke/js/smoke.js

Lines changed: 44 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -751,21 +751,11 @@ $.smkDatePicker = function(date) {
751751

752752
if(date !== ''){
753753
// Se obtiene el dia
754-
var day = date.getDate();
754+
var day = (date.getDate() < 10 ? '0' : '') + date.getDate();
755755
// Se obtiene el mes
756-
var month = date.getMonth() + 1;
756+
var month = ((date.getMonth() + 1) < 10 ? '0' : '') + (date.getMonth() + 1);
757757
// Se obtiene el año
758758
var year = date.getFullYear();
759-
760-
// Si el dia es menor que 10 se agrega 0 al inicio
761-
if (day < 10) {
762-
day = '0' + day;
763-
}
764-
// Si el mes es menor que 10 se agrega 0 al inicio
765-
if (month < 10) {
766-
month = '0' + month;
767-
}
768-
769759
// Se construye la fecha con el formato para BD yyyy-mm-dd
770760
result = year + '-' + month + '-' + day;
771761
}else{
@@ -802,86 +792,78 @@ $.smkDate = function(options) {
802792

803793
var languaje = {
804794
es: {
805-
shortMonthNames : ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
795+
shortMonthNames : ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
806796
monthNames : ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
807797
}
808798
};
809799

810-
if(settings.lang != 'es'){
811-
languaje = $.smkDate.Languaje;
800+
//Se obtienen los separadores
801+
var validDate = /\d+|[a-zA-z]/g;
802+
var separator = settings.date.replace(validDate, '\0').split('\0');
803+
// Se obtiene las partes de la fecha
804+
var splitDate = settings.date.match(validDate);
805+
806+
if(settings.lang == 'es'){
807+
// Se formatea la fecha (yyyy,mm,dd) para poder instanciar el método new Date()
808+
if(splitDate[0].length == 4){
809+
// Formato yyyy-mm-dd => yyyy,mm,dd
810+
settings.date = new Date(splitDate[0],(splitDate[1]-1),splitDate[2]);
811+
}else{
812+
// Formato dd-mm-yyyy => yyyy,mm,dd
813+
settings.date = new Date(splitDate[2],(splitDate[1]-1),splitDate[0]);
814+
}
812815
}else{
813-
// Se obtienen los separadores
814-
var validDate = /\d+|[a-zA-z]/g;
815-
var separator = settings.date.replace(validDate, '\0').split('\0');
816-
// Se obtiene el formato
817-
var splitDate = settings.date.match(validDate);
818-
// Se formatea la fecha (format gringo) para poder instanciar el método new Date()
819-
//var splitDate = settings.date.split('-');
816+
languaje = $.smkDate.Languaje;
817+
// Se formatea la fecha (yyyy,mm,dd) para poder instanciar el método new Date()
820818
if(splitDate[0].length == 4){
821-
// Formato yyyy-mm-dd => mm-dd-yyyy
822-
settings.date = splitDate[1] + '-' + splitDate[2] + '-' + splitDate[0];
819+
// Formato yyyy-dd-mm => yyyy,mm,dd
820+
settings.date = new Date(splitDate[0],(splitDate[2]-1),splitDate[1]);
823821
}else{
824-
// Formato dd-mm-yyyy => mm-dd-yyyy
825-
settings.date = splitDate[1] + '-' + splitDate[0] + '-' + splitDate[2];
822+
// Formato mm-dd-yyyy => yyyy,mm,dd
823+
settings.date = new Date(splitDate[2],(splitDate[0]-1),splitDate[1]);
826824
}
827825
}
828826

829-
var date = new Date(settings.date);
830827
var result = '';
831828

832-
if(date != 'Invalid Date'){
833-
// Se obtiene el dia
834-
var day = date.getDate();
835-
// Se obtiene el mes
836-
var month = date.getMonth() + 1;
837-
838-
// Si el dia es menor que 10 se agrega 0 al inicio
839-
if (day < 10) {
840-
day = '0' + day;
841-
}
842-
// Si el mes es menor que 10 se agrega 0 al inicio
843-
if (month < 10) {
844-
month = '0' + month;
845-
}
829+
if(settings.date != 'Invalid Date'){
846830

847831
// Se crea el array que contiene el día, mes y año
848832
var arrayDate = {
849833
// Se obtiene el dia
850-
'd' : date.getDate(),
851-
'dd' : day,
834+
'd' : settings.date.getDate(),
835+
'dd' : (settings.date.getDate() < 10 ? '0' : '') + settings.date.getDate(),
852836
// Se obtiene el mes
853-
'm' : date.getMonth() + 1, //January is 0!
854-
'mm' : month,
837+
'm' : settings.date.getMonth() + 1, //January is 0!
838+
'mm' : ((settings.date.getMonth() + 1) < 10 ? '0' : '') + (settings.date.getMonth() + 1),
839+
'M' : languaje[settings.lang].shortMonthNames[settings.date.getMonth()],
840+
'MM' : languaje[settings.lang].monthNames[settings.date.getMonth()],
855841
// Se obtiene el año
856-
'yyyy' : date.getFullYear(),
842+
'yyyy' : settings.date.getFullYear(),
857843
// Se obtiene el año 2 digitos
858-
'yy' : date.getFullYear().toString().substring(2),
844+
'yy' : settings.date.getFullYear().toString().substring(2),
859845
// Se obtiene la hora
860-
'hh' : date.getHours(),
846+
'hh' : settings.date.getHours(),
861847
// Se obtienen los minutos
862-
'mi' : date.getMinutes(),
848+
'mi' : settings.date.getMinutes(),
863849
// Se obtienen los segundos
864-
'ss' : date.getSeconds()
850+
'ss' : settings.date.getSeconds()
865851
};
866852

867853
// Se obtienen los separadores
868-
var validParts = /dd?|DD?|mm?|MM?|yy(?:yy)?/g;
869-
var separators = settings.format.replace(validParts, '\0').split('\0');
870-
// Se obtiene el formato
871-
var parts = settings.format.match(validParts);
854+
var validFormat = /dd?|DD?|mm?|MM?|yy(?:yy)?/g;
855+
var separators = settings.format.replace(validFormat, '\0').split('\0');
856+
// Se obtienen las partes del formato
857+
var splitFormat = settings.format.match(validFormat);
872858

873859
// Se construye la fecha con el formato y los separadores indicados
874-
$.each(parts, function(index, val) {
875-
if(val == 'M'){
876-
result += separators[index] + languaje[settings.lang].shortMonthNames[date.getMonth()];
877-
}else if(val == 'MM'){
878-
result += separators[index] + languaje[settings.lang].monthNames[date.getMonth()];
879-
}else{
880-
result += separators[index] + arrayDate[val];
881-
}
860+
$.each(splitFormat, function(key, val) {
861+
result += separators[key] + arrayDate[val];
882862
});
863+
883864
}else{
884865
result = '';
866+
console.log('Invalid Date');
885867
}
886868

887869
// Se retorna la fecha formateada

smoke/js/smoke.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)