{"action":"created","issue":{"url":"https://api.github.com/repos/icambron/twix.js/issues/77","labels_url":"https://api.github.com/repos/icambron/twix.js/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/icambron/twix.js/issues/77/comments","events_url":"https://api.github.com/repos/icambron/twix.js/issues/77/events","html_url":"https://github.com/icambron/twix.js/issues/77","id":106720458,"number":77,"title":"isValid() does not take locale into account","user":{"login":"marduone","id":14308282,"avatar_url":"https://avatars.githubusercontent.com/u/14308282?v=3","gravatar_id":"","url":"https://api.github.com/users/marduone","html_url":"https://github.com/marduone","followers_url":"https://api.github.com/users/marduone/followers","following_url":"https://api.github.com/users/marduone/following{/other_user}","gists_url":"https://api.github.com/users/marduone/gists{/gist_id}","starred_url":"https://api.github.com/users/marduone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marduone/subscriptions","organizations_url":"https://api.github.com/users/marduone/orgs","repos_url":"https://api.github.com/users/marduone/repos","events_url":"https://api.github.com/users/marduone/events{/privacy}","received_events_url":"https://api.github.com/users/marduone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-16T08:04:50Z","updated_at":"2015-09-18T12:25:36Z","closed_at":null,"body":"It seems that twix isValid() does not check the validity of the moment objects themselves.\r\nMoment 2.10.6\r\nTwix 0.7.2\r\n\r\nConsider the following:\r\n\r\n```js\r\n> var moment = require('moment')\r\nundefined\r\n> require('twix')\r\n{ [Function: Twix] _extend: [Function], formatTemplate: [Function] }\r\n> moment.locale('es')\r\n'es'\r\n> var start = moment('15 Aug 2015', 'DD MMM YYYY')\r\nundefined\r\n> start.isValid()\r\nfalse\r\n> var end = moment('20 Aug 2015', 'DD MMM YYYY')\r\nundefined\r\n> end.isValid()\r\nfalse\r\n> var range = start.twix(end)\r\nundefined\r\n> range.format()\r\n'Invalid date, Invalid date'\r\n> range.isValid()\r\ntrue\r\n>\r\n> start\r\n{ [Number: 1421272800000]\r\n  _isAMomentObject: true,\r\n  _i: '15 Aug 2015',\r\n  _f: 'DD MMM YYYY',\r\n  _isUTC: false,\r\n  _pf: \r\n   { empty: false,\r\n     unusedTokens: [],\r\n     unusedInput: [],\r\n     overflow: -1,\r\n     charsLeftOver: 0,\r\n     nullInput: false,\r\n     invalidMonth: 'Aug',\r\n     invalidFormat: false,\r\n     userInvalidated: false,\r\n     iso: false },\r\n  _locale: \r\n   { _months: \r\n      [ 'Enero',\r\n        'Febrero',\r\n        'Marzo',\r\n        'Abril',\r\n        'Mayo',\r\n        'Junio',\r\n        'Julio',\r\n        'Agosto',\r\n        'Septiembre',\r\n        'Octubre',\r\n        'Noviembre',\r\n        'Diciembre' ],\r\n     monthsShort: [Function],\r\n     _weekdays: \r\n      [ 'Domingo',\r\n        'Lunes',\r\n        'Martes',\r\n        'Miércoles',\r\n        'Jueves',\r\n        'Viernes',\r\n        'Sábado' ],\r\n     _weekdaysShort: [ 'Dom.', 'Lun.', 'Mar.', 'Mié.', 'Jue.', 'Vie.', 'Sáb.' ],\r\n     _weekdaysMin: [ 'Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá' ],\r\n     _longDateFormat: \r\n      { LT: 'H:mm',\r\n        LTS: 'H:mm:ss',\r\n        L: 'DD/MM/YYYY',\r\n        LL: 'D [de] MMMM [de] YYYY',\r\n        LLL: 'D [de] MMMM [de] YYYY H:mm',\r\n        LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm' },\r\n     _calendar: \r\n      { sameDay: [Function],\r\n        nextDay: [Function],\r\n        nextWeek: [Function],\r\n        lastDay: [Function],\r\n        lastWeek: [Function],\r\n        sameElse: 'L' },\r\n     _relativeTime: \r\n      { future: 'en %s',\r\n        past: 'hace %s',\r\n        s: 'unos segundos',\r\n        m: 'un minuto',\r\n        mm: '%d minutos',\r\n        h: 'una hora',\r\n        hh: '%d horas',\r\n        d: 'un día',\r\n        dd: '%d días',\r\n        M: 'un mes',\r\n        MM: '%d meses',\r\n        y: 'un año',\r\n        yy: '%d años' },\r\n     _ordinalParse: /\\d{1,2}º/,\r\n     _ordinal: '%dº',\r\n     _week: { dow: 1, doy: 4 },\r\n     _abbr: 'es',\r\n     _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n     _monthsParse: \r\n      [ /^Enero|^Ene/i,\r\n        /^Febrero|^Feb/i,\r\n        /^Marzo|^Mar/i,\r\n        /^Abril|^Abr/i,\r\n        /^Mayo|^May/i,\r\n        /^Junio|^Jun/i,\r\n        /^Julio|^Jul/i,\r\n        /^Agosto|^Ago/i,\r\n        /^Septiembre|^Sep/i,\r\n        /^Octubre|^Oct/i,\r\n        /^Noviembre|^Nov/i,\r\n        /^Diciembre|^Dic/i ],\r\n     _longMonthsParse: [],\r\n     _shortMonthsParse: [] },\r\n  _d: Thu Jan 15 2015 00:00:00 GMT+0200 (EET),\r\n  _isValid: false }\r\n>\r\n> range\r\n{ start: \r\n   { [Number: 1421272800000]\r\n     _isAMomentObject: true,\r\n     _i: '15 Aug 2015',\r\n     _f: 'DD MMM YYYY',\r\n     _isUTC: false,\r\n     _pf: \r\n      { empty: false,\r\n        unusedTokens: [],\r\n        unusedInput: [],\r\n        overflow: -1,\r\n        charsLeftOver: 0,\r\n        nullInput: false,\r\n        invalidMonth: 'Aug',\r\n        invalidFormat: false,\r\n        userInvalidated: false,\r\n        iso: false },\r\n     _locale: \r\n      { _months: [Object],\r\n        monthsShort: [Function],\r\n        _weekdays: [Object],\r\n        _weekdaysShort: [Object],\r\n        _weekdaysMin: [Object],\r\n        _longDateFormat: [Object],\r\n        _calendar: [Object],\r\n        _relativeTime: [Object],\r\n        _ordinalParse: /\\d{1,2}º/,\r\n        _ordinal: '%dº',\r\n        _week: [Object],\r\n        _abbr: 'es',\r\n        _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n        _monthsParse: [Object],\r\n        _longMonthsParse: [],\r\n        _shortMonthsParse: [] },\r\n     _d: Thu Jan 15 2015 00:00:00 GMT+0200 (EET),\r\n     _isValid: false },\r\n  end: \r\n   { [Number: 1421704800000]\r\n     _isAMomentObject: true,\r\n     _i: '20 Aug 2015',\r\n     _f: 'DD MMM YYYY',\r\n     _isUTC: false,\r\n     _pf: \r\n      { empty: false,\r\n        unusedTokens: [],\r\n        unusedInput: [],\r\n        overflow: -1,\r\n        charsLeftOver: 0,\r\n        nullInput: false,\r\n        invalidMonth: 'Aug',\r\n        invalidFormat: false,\r\n        userInvalidated: false,\r\n        iso: false },\r\n     _locale: \r\n      { _months: [Object],\r\n        monthsShort: [Function],\r\n        _weekdays: [Object],\r\n        _weekdaysShort: [Object],\r\n        _weekdaysMin: [Object],\r\n        _longDateFormat: [Object],\r\n        _calendar: [Object],\r\n        _relativeTime: [Object],\r\n        _ordinalParse: /\\d{1,2}º/,\r\n        _ordinal: '%dº',\r\n        _week: [Object],\r\n        _abbr: 'es',\r\n        _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n        _monthsParse: [Object],\r\n        _longMonthsParse: [],\r\n        _shortMonthsParse: [] },\r\n     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),\r\n     _isValid: false },\r\n  allDay: false,\r\n  _trueStart: \r\n   { [Number: 1421272800000]\r\n     _isAMomentObject: true,\r\n     _i: '15 Aug 2015',\r\n     _f: 'DD MMM YYYY',\r\n     _isUTC: false,\r\n     _pf: \r\n      { empty: false,\r\n        unusedTokens: [],\r\n        unusedInput: [],\r\n        overflow: -1,\r\n        charsLeftOver: 0,\r\n        nullInput: false,\r\n        invalidMonth: 'Aug',\r\n        invalidFormat: false,\r\n        userInvalidated: false,\r\n        iso: false },\r\n     _locale: \r\n      { _months: [Object],\r\n        monthsShort: [Function],\r\n        _weekdays: [Object],\r\n        _weekdaysShort: [Object],\r\n        _weekdaysMin: [Object],\r\n        _longDateFormat: [Object],\r\n        _calendar: [Object],\r\n        _relativeTime: [Object],\r\n        _ordinalParse: /\\d{1,2}º/,\r\n        _ordinal: '%dº',\r\n        _week: [Object],\r\n        _abbr: 'es',\r\n        _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n        _monthsParse: [Object],\r\n        _longMonthsParse: [],\r\n        _shortMonthsParse: [] },\r\n     _d: Thu Jan 15 2015 00:00:00 GMT+0200 (EET),\r\n     _isValid: false },\r\n  _lastMilli: \r\n   { [Number: 1421704800000]\r\n     _isAMomentObject: true,\r\n     _i: '20 Aug 2015',\r\n     _f: 'DD MMM YYYY',\r\n     _isUTC: false,\r\n     _pf: \r\n      { empty: false,\r\n        unusedTokens: [],\r\n        unusedInput: [],\r\n        overflow: -1,\r\n        charsLeftOver: 0,\r\n        nullInput: false,\r\n        invalidMonth: 'Aug',\r\n        invalidFormat: false,\r\n        userInvalidated: false,\r\n        iso: false },\r\n     _locale: \r\n      { _months: [Object],\r\n        monthsShort: [Function],\r\n        _weekdays: [Object],\r\n        _weekdaysShort: [Object],\r\n        _weekdaysMin: [Object],\r\n        _longDateFormat: [Object],\r\n        _calendar: [Object],\r\n        _relativeTime: [Object],\r\n        _ordinalParse: /\\d{1,2}º/,\r\n        _ordinal: '%dº',\r\n        _week: [Object],\r\n        _abbr: 'es',\r\n        _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n        _monthsParse: [Object],\r\n        _longMonthsParse: [],\r\n        _shortMonthsParse: [] },\r\n     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),\r\n     _isValid: false },\r\n  _transferrableEnd: \r\n   { [Number: 1421704800000]\r\n     _isAMomentObject: true,\r\n     _i: '20 Aug 2015',\r\n     _f: 'DD MMM YYYY',\r\n     _isUTC: false,\r\n     _pf: \r\n      { empty: false,\r\n        unusedTokens: [],\r\n        unusedInput: [],\r\n        overflow: -1,\r\n        charsLeftOver: 0,\r\n        nullInput: false,\r\n        invalidMonth: 'Aug',\r\n        invalidFormat: false,\r\n        userInvalidated: false,\r\n        iso: false },\r\n     _locale: \r\n      { _months: [Object],\r\n        monthsShort: [Function],\r\n        _weekdays: [Object],\r\n        _weekdaysShort: [Object],\r\n        _weekdaysMin: [Object],\r\n        _longDateFormat: [Object],\r\n        _calendar: [Object],\r\n        _relativeTime: [Object],\r\n        _ordinalParse: /\\d{1,2}º/,\r\n        _ordinal: '%dº',\r\n        _week: [Object],\r\n        _abbr: 'es',\r\n        _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n        _monthsParse: [Object],\r\n        _longMonthsParse: [],\r\n        _shortMonthsParse: [] },\r\n     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),\r\n     _isValid: false },\r\n  _displayEnd: \r\n   { [Number: 1421704800000]\r\n     _isAMomentObject: true,\r\n     _i: '20 Aug 2015',\r\n     _f: 'DD MMM YYYY',\r\n     _isUTC: false,\r\n     _pf: \r\n      { empty: false,\r\n        unusedTokens: [],\r\n        unusedInput: [],\r\n        overflow: -1,\r\n        charsLeftOver: 0,\r\n        nullInput: false,\r\n        invalidMonth: 'Aug',\r\n        invalidFormat: false,\r\n        userInvalidated: false,\r\n        iso: false },\r\n     _locale: \r\n      { _months: [Object],\r\n        monthsShort: [Function],\r\n        _weekdays: [Object],\r\n        _weekdaysShort: [Object],\r\n        _weekdaysMin: [Object],\r\n        _longDateFormat: [Object],\r\n        _calendar: [Object],\r\n        _relativeTime: [Object],\r\n        _ordinalParse: /\\d{1,2}º/,\r\n        _ordinal: '%dº',\r\n        _week: [Object],\r\n        _abbr: 'es',\r\n        _ordinalParseLenient: /\\d{1,2}º|\\d{1,2}/,\r\n        _monthsParse: [Object],\r\n        _longMonthsParse: [],\r\n        _shortMonthsParse: [] },\r\n     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),\r\n     _isValid: false } }\r\n```"},"comment":{"url":"https://api.github.com/repos/icambron/twix.js/issues/comments/141437464","html_url":"https://github.com/icambron/twix.js/issues/77#issuecomment-141437464","issue_url":"https://api.github.com/repos/icambron/twix.js/issues/77","id":141437464,"user":{"login":"icambron","id":244988,"avatar_url":"https://avatars.githubusercontent.com/u/244988?v=3","gravatar_id":"","url":"https://api.github.com/users/icambron","html_url":"https://github.com/icambron","followers_url":"https://api.github.com/users/icambron/followers","following_url":"https://api.github.com/users/icambron/following{/other_user}","gists_url":"https://api.github.com/users/icambron/gists{/gist_id}","starred_url":"https://api.github.com/users/icambron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icambron/subscriptions","organizations_url":"https://api.github.com/users/icambron/orgs","repos_url":"https://api.github.com/users/icambron/repos","events_url":"https://api.github.com/users/icambron/events{/privacy}","received_events_url":"https://api.github.com/users/icambron/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T12:25:36Z","updated_at":"2015-09-18T12:25:36Z","body":"Hmm, yeah, I'd accept a PR that checks that the start and end times are valid in `isValid()`."}}