Firefox new Date(2017, 9, 1).getMonth() -> 8?
Publicado por jose (1 intervención) el 28/07/2017 00:26:02
Buenas amigos, tengo este caso interesante:
Con el navegador firefox 54.0(64 bits) tengo el siguiente problema
al crear la fecha de octubre 01/10/2017.
En chrome Versión 55.0.2883.87 (64-bit) funciona correctamente.
Test de todos los meses 2017 dia 1 (firefox).
Test de todos los meses 2017 dia 2 (firefox).
Si alguien entiende porque ocurre eso agradecería su respuesta.
Saludos.
Con el navegador firefox 54.0(64 bits) tengo el siguiente problema
al crear la fecha de octubre 01/10/2017.
1
2
fecha = new Date(2017, 9, 1); // octubre es 9 con base 0
fecha.getMonth(); // Debe ser 9 pero retorna 8 <--- MAL
En chrome Versión 55.0.2883.87 (64-bit) funciona correctamente.
1
2
fecha = new Date(2017, 9, 1); // octubre es 9 con base 0
fecha.getMonth(); // 9 <--- BIEN
Test de todos los meses 2017 dia 1 (firefox).
1
2
3
4
5
6
7
8
9
10
11
12
new Date(2017, 0, 1).getMonth(); // 0: ene OK
new Date(2017, 1, 1).getMonth(); // 1: feb OK
new Date(2017, 2, 1).getMonth(); // 2: mar OK
new Date(2017, 3, 1).getMonth(); // 3: abr OK
new Date(2017, 4, 1).getMonth(); // 4: may OK
new Date(2017, 5, 1).getMonth(); // 5: jun OK
new Date(2017, 6, 1).getMonth(); // 6: jul OK
new Date(2017, 7, 1).getMonth(); // 7: ago OK
new Date(2017, 8, 1).getMonth(); // 8: set OK
new Date(2017, 9, 1).getMonth(); // 9: oct FAIL (nuevamente 8)
new Date(2017, 10, 1).getMonth(); // 10: nov OK
new Date(2017, 11, 1).getMonth(); // 11: dic OK
Test de todos los meses 2017 dia 2 (firefox).
1
2
3
4
5
6
7
8
9
10
11
12
new Date(2017, 0, 2).getMonth(); // 0: ene OK
new Date(2017, 1, 2).getMonth(); // 1: feb OK
new Date(2017, 2, 2).getMonth(); // 2: mar OK
new Date(2017, 3, 2).getMonth(); // 3: abr OK
new Date(2017, 4, 2).getMonth(); // 4: may OK
new Date(2017, 5, 2).getMonth(); // 5: jun OK
new Date(2017, 6, 2).getMonth(); // 6: jul OK
new Date(2017, 7, 2).getMonth(); // 7: ago OK
new Date(2017, 8, 2).getMonth(); // 8: set OK
new Date(2017, 9, 2).getMonth(); // 9: oct OK
new Date(2017, 10, 2).getMonth(); // 10: nov OK
new Date(2017, 11, 2).getMonth(); // 11: dic OK
Si alguien entiende porque ocurre eso agradecería su respuesta.
Saludos.
Valora esta pregunta


0