Giter VIP home page Giter VIP logo

twix.js's Introduction

Twix.js

MIT License Build Status Version NPM version

Twix is a comprehensive JS library for working with date ranges, and includes a customizable smart formatter. It's written in CoffeeScript and it depends on Moment.js.

Some examples:

var t = moment("1982-01-25T09:30").twix("1982-01-25T13:30");

t.format();  //=> Jan 25, 1982, 9:30 AM - 1:30 PM

t.isSame("day"); //=> true
t.humanizeLength(); //=> "4 hours"
t.count("days"); //=> 1
t.intersection(otherRange); //=> another range

See the documentation for more.

Documentation

You can find comprehensive docs here:

Detailed documentation

Breaking change in 1.0.0: Removed the deprecated showYear and showDate smart formatter options. Use hideYear, hideDate, implicitYear, and implicitDate instead.

Building

If you want to build and test Twix for yourself, make wraps everything you need:

Command Function
make configure Install dependencies (same as npm install)
make or make build Compile src/*.coffee to dist/*.js
make test Run Mocha suite
make lint Linter
make bench Microbenchmarks

Contributing

Patches are welcome!

  • Don't include your changes to the generated .js files in the patch; they're much harder to merge. I'll generate them when I cut the release.
  • Make sure you run the linter and the tests before submitting a PR. Use make lint and make test.
  • If you make a change that will need documentation, make the appropriate update to docs. It will get published to the website on the next release.

Changelog

CHANGELOG

Copyright 2012-2015 Isaac Cambron and contributors. Distributed under the MIT License. See LICENSE for details.

Phasers to stun

twix.js's People

Contributors

andresmoschini avatar awirick avatar benesch avatar benmosher avatar butterflyhug avatar cwperry avatar feload avatar icambron avatar ivanjov avatar leo-naeka avatar markstos avatar mrngoitall avatar nw avatar pandafulmanda avatar sh avatar spencern avatar splendido avatar suzannehamilton avatar tkrotoff avatar tomdrn avatar wbercx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twix.js's Issues

exclude and xor

While I'm sure this can be built up with iterators, it would be great to have an exclude and xor to complement union and intersection, as seen here. Pretty much the first thing I thought of using twix for was an exclude, but it wasn't available. The problem, of course, is how to handle the fact that both can result in two ranges in certain cases. That's probably why it has been avoided. Any thoughts?

var range1 = moment("1982-05-25").twix("1982-05-30");
var range2 = moment("1982-05-27").twix("1982-06-13");

range2.exclude(range1); //=> 5/31/82 - 6/13/1982

TypeError: o is not an object (or typeerror t i not an object)

Uncompressed Twix

cd ~/Dev/websites/mynewproject/application/base/static/javascripts/vendor/
wget https://raw.github.com/icambron/twix.js/master/bin/twix.js
# viz below twix integration

Results in

[21:34:11.113] TypeError: o is not an object @ http://mynewproject.local:8000/static/javascripts/vendor/twix.js:600

Minified Twix

cd ~/Dev/websites/mynewproject/application/base/static/javascripts/vendor/
wget https://raw.github.com/icambron/twix.js/master/bin/twix.min.js
# viz below twix integration

Results in

[21:58:08.282] TypeError: t is not an object @ http://mynewproject.local:8000/static/javascripts/vendor/twix.min.js:2

Twix Integration

here is the /static/javascript/main.js

require.config({
    paths : {
        'moment': 'vendor/moment.js/moment.min',
        'twix': 'vendor/twix.min',
    },
    shims: {
        'angular': { 'exports': 'angular' },
    })

require(['angular',
         'moment',
         'twix'],
        function baseManager(angular, moment){
            angular
                .module("app", [ ])
                .config(['$routeProvider', '$locationProvider',
                    function($routeProvider, $locationProvider){
                        $routeProvider
                            .when('/', {
                                controller: function($scope, $route){
                                    $scope.TimeSlots = moment("1/25/1982 9:30 AM").twix("1/25/1982 1:30 PM", true);
                                }
                            })

                    }]);
                angular.bootstrap(document, ['app']);
        });

Support AMD

Needs some thought, specifically about how the pluggy-inny part works, and internationalization

Correct way to get the start date

I want to get the start date from a range. Wich is the correct way of doing it?
I can iterate and get the first element but maybe theres a better option like range.first()?
Can I use the 'start' property?

difference() returns wrong values when ranges are not created equally

So basically if I create two ranges using different parsing methods and try to get the difference() between them, the returned array is wrong.

For example:

var range1 = moment(new Date(2015, 01, 01)).twix(new Date(2015, 01, 10));
var range2 = moment('02/01/2015', 'DD/MM/YYYY').twix('06/01/2015', 'DD/MM/YYYY');
var diff = range1.difference(range2);

this will return an array containing a wrong Twix object, in this case will just return 'range1'

Different object properties created by same syntax

I'm creating some twix ranges to subtract out of a scheduling calendar (take break ranges out of a school year).

It appears I'm getting objects with different properties, depending on when in my program I'm creating the twix. Here's the creation statement. The very same statement is being used each time, and breakDates contains the same data both times.
breakDates[0]='10/14/2014' breakDates[1]='10/15/2014'

var curBreakRange = moment(breakDates[0], "MM/DD/YYYY").twix(breakDates[1], "MM/DD/YYYY", {allDay: true});

One time, I get an object like this:
bad_object

Another time, I get an object like this:
good_object

The latter is what gives me correct results when used with .difference later in the program.

I'll gladly help debug further with some guidance.

Thanks,
David

count() seems to be adding 1 extra day/hour/etc.

Hi,

So I was testing out the count() feature to calculate the number of days between dates, and it seems to be adding in 1 extra hour/day/etc. (depending on what you specify).

eg.
Taken from your site:
moment("5/25/1982").twix("5/28/1982").count("days") // Actually returns 4 and not 3

I simply did a console log to test this. Let me know if there's a known ticket out for this or what the issue may be. For now I'll have to just manually correct the calculation.

Thanks

Ted

Moment 2.8.0 breaks Twix

In this commit between Moment 2.7 and 2.8, the _lang property was removed from the moment object. Twix bundles moment 2.6 currently, but if 2.8 is found first, unfortunately it breaks Twix now due to this bit that happens during twix construction since moment.fn._lang is undefined:

Twix._extend(getPrototypeOf(moment.fn._lang), {
  _twix: Twix.defaults
});

Unfortunately I'm not sure what the proper fix is, so I have no patch to propose. For now I'm forced to pin moment throughout my app at 2.7.0 until this is resolved. Thanks!

Move languages into one file

I'm not actually sure it's necessary to have different files for each language. Would simplify things to just squish them altogether. For example, I wouldn't need to inject the boilerplate into each file.

Ability to reset a twix iterator?

Hi, thanks for a wicked library its saved me lots of time.

Do you know if there is a nice way to reset a twix iterator?

I want to re-use a iterator several times but I need to always create a new one like as follows. (basic example)

var range = moment(startDate).startOf('day').twix(moment(endDate).startOf('day')).iterate('days');

Is there a inbuilt way e.g. range.reset() or is the preferred way to simply create a new one each time?

Many thanks

James

Duration extensions fail in Moment 2.10

The moment.duration().* functions don't work in Moment 2.10. The underlying issue will be fixed in Moment, and once you have the latest version of Moment, the relevant Twix should just start working again.

Note if you found this ticket trying to find out why Twix isn't working AT ALL with the latest Moment, you need to upgrade Twix to 0.6.3.

Options for en dash + removing space around separator

Right now I'm doing something like this:

return start.twix(end, true).format().replace(' - ', '–');

It'd be nice if the en dash was used by default instead of the hyphen, or at least have an option for it to be used. I also want to remove the spaces around the hyphen.

issue with difference behaviour

Hi!

First of all, thanks for this very useful library!

I met some unexpected issue with twix.js.

var range1 = moment('Fri Jun 05 2015 10:30:00 GMT+0200').twix('Fri Jun 12 2015 06:00:00 GMT+0200');

// The first argument is out of the range1
var diff =  range1.difference(
  moment('Fri Jun 05 2015 09:30:00 GMT+0200').twix('Fri Jun 05 2015 10:30:00 GMT+0200'),
  moment('Mon Jun 08 2015 10:00:00 GMT+0200').twix('Thu Jun 11 2015 10:00:00 GMT+0200')
);

// NB: I know that the moment instanciations are deprecated, this is just for example.

I was expected the following result array:

[
  Fri Jun 05 2015 10:30:00 GMT+0200 - Mon Jun 08 2015 10:00:00 GMT+0200, 
  Thu Jun 11 2015 10:00:00 GMT+0200 - Fri Jun 12 2015 06:00:00 GMT+0200
]

But I get this result:

[
  Thu Jun 11 2015 10:00:00 GMT+0200 - Fri Jun 12 2015 06:00:00 GMT+0200
]

Twix.js totally skips the first difference.

If I change the first difference argument by +1 minute as following:

var range1 = moment('Fri Jun 05 2015 10:30:00 GMT+0200').twix('Fri Jun 12 2015 06:00:00 GMT+0200');

// The first argument has intersection with the range1
var diff =  range1.difference(
  moment('Fri Jun 05 2015 09:30:00 GMT+0200').twix('Fri Jun 05 2015 10:31:00 GMT+0200'),
  moment('Mon Jun 08 2015 10:00:00 GMT+0200').twix('Thu Jun 11 2015 10:00:00 GMT+0200')
);

I get this expected result:

[
   Fri Jun 05 2015 10:31:00 GMT+0200 - Mon Jun 08 2015 10:00:00 GMT+0200, 
   Thu Jun 11 2015 10:00:00 GMT+0200 - Fri Jun 12 2015 06:00:00 GMT+0200
]

If I change the first difference argument by -1 minute as following:

var range1 = moment('Fri Jun 05 2015 10:30:00 GMT+0200').twix('Fri Jun 12 2015 06:00:00 GMT+0200');

// The first argument is no intersection with the range1 (=out)
var diff =  range1.difference(
  moment('Fri Jun 05 2015 09:30:00 GMT+0200').twix('Fri Jun 05 2015 10:29:00 GMT+0200'),
  moment('Mon Jun 08 2015 10:00:00 GMT+0200').twix('Thu Jun 11 2015 10:00:00 GMT+0200')
);

I get this expected result:

[
   Fri Jun 05 2015 10:30:00 GMT+0200 - Mon Jun 08 2015 10:00:00 GMT+0200, 
   Thu Jun 11 2015 10:00:00 GMT+0200 - Fri Jun 12 2015 06:00:00 GMT+0200
]

So this issue happens when one of the difference arguments has exactly the same date.

Can you confirm my observations?

No RTL support

Moment.js has support for many languages, including RTL ones. Twix only supports LTR languages due to the way it formats strings.

For example, in English, a string like "July 26-29" makes sense. In Hebrew it should read "[the]26-29 [of]July."

Note that there are optional "the" and "of" without spaces. It's possible to put the "[the]" component on each of the days but it should be omitted for smart formatting. The "[of]" part can be easily dealt with elsewhere.

Quick ideas on how to fix:

  • Add a showDayBeforeMonth option, default false, that when set to true flips the order as above
  • Add a dayPrefix option, default undefined, that when set is prepended to the day component

Add isValid() function

isValid() should check the interval is valid, i.e end is after start.

var start = moment('2013-05-09');
var end = moment('2013-05-10');
moment.twix(start, end).isValid(); // True

var start = moment('2013-05-10');
var end = moment('2013-05-09');
moment.twix(start, end).isValid(); // False

Iterating months is broken

startDate = moment("2014-10-01")
endDate = moment("2014-12-01")
dateRange = moment.twix(startDate, endDate, true)

dateRange.count("months") //=> 3
it = dateRange.iterate("months")
it.next() //=> moment for 2014-10-01
it.next() //=> moment for 2014-11-01
it.next() //=> null

Should give us 12/1

Replace lang with introspection

This seems obvious in retrospect, but instead of having settings for different languages (as we currently do for French), we should just parse the time formats in the Moment locales. For example...

> moment.langData('fr')._longDateFormat.LL
'D MMMM YYYY'
> moment.langData('en')._longDateFormat.LL
'MMMM D YYYY'

...tells us what "slot" the month, date, and year go in. We can do something similar for 24 hour time vs AM/PM by checking LT. That gets me out managing locale files gets us a whole bunch of locales for free.

/cc @leo-naeka

Locale Configurable Template Function

Allow for configurable locale specific template functions. This would allow for more complex range formatting of localized ranges than the current "firstDate - secondDate" format.

e.g. "del 6 - 8 de septiembre del 2014"

Fix tests for FF

FF can't parse the date format "1982-5-25" (needs to be "1982-05-25"), which breaks a lot of the tests.

Dropping the #twix(string) signature (sort of)

There's going to be a big change to how Twix works, at least superficially. In short, because of changes to Moment, this is going to stop working:

someMomentObject.twix('5/25/1982');

That's because Moment is deprecating most uses moment(someString) (specifically, anything other than an ISO-8601 string). Here's what we're going to do:

  1. You can still say twix(string) or twix(string, boolean), but you'll get a deprecation warning from Moment unless the string is ISO-8601. Eventually, it will fail when Moment gets upgraded.
  2. I'm going to add twix(string, string) and twix(string, string, boolean) as signatures, so that you can do more complicated parsing without having to resort to twix(moment(string, string)). This is a breaking change in the sense that if you used a truthy string as your second argument, it will now be used as a format string instead of as the allDay option. I think that's probably pretty rare.
  3. I'm going to remind everyone that you can always do twix(new Date('5/25/1982'))
  4. Gobs of doc changes.

TypeError: Object <date> has no method 'twix'

Running this basic example from doc:

var moment = require('moment');
require('twix');

var startTime = moment('2012 juillet', 'YYYY MMM', 'fr');
var endTime = moment('2012 August', 'YYYY MMM', 'en');
var range = startTime.twix(endTime);
console.log(range.simpleFormat());

results in:

var range = startTime.twix(endTime);
                      ^
TypeError: Object Sun Jul 01 2012 00:00:00 GMT+0530 has no method 'twix'

Rollback #41?

#41 is a perf optimization that may not be needed anymore, now that Moment's clone operation is much faster. Need to investigate whether there's still significant gain there, and if so, revert it, since it has some side-effects I'd rather not have, all other things being equal.

Intersection / Overlap Behavior is inconsistent

Comparing these two ranges:
range1: 'Mar 1, 12 AM - Mar 7, 12 AM'
range2: 'Feb 27, 12 AM - Mar 1, 12 AM'

Doing a range1.overlap(range2) causes the following result when logging the output:
LOG: false

However doing a range1.intersection(range2) causes this result when logging the output:
LOG: 'Mar 1, 12 AM'

Shouldn't the intersection return nothing?

Iterate twix range

Hey, I had some troubles iterating a twix range in day steps, as the iterator always iterates one day more than I actually wanted (normal version, not the inner iteration). I guess this is a problem due to a change in moment.js since 2.0.0. The diff function returns now a value rounded down (not rounded as before). I saw in your code that the count function always adds +1 to the diff given by moment.js, so this might be a mistake now.

Twix.prototype.count = function(period) {
        var end, start;
        start = this.start.clone().startOf(period);
        end = this.end.clone().startOf(period);
        return end.diff(start, period) + 1; // is this still correct?
      };

Possible bug with contains and allDay

While checking to see if the range 2015-07-01 - 2015-07-31 contained certain dates, I noticed that 2015-08-01 was evaluating as true.

I was using: moment("2015-07-01").twix("2015-07-31", {allDay: true}).contains("2015-08-01");

After doing some more testing I noticed that if i add a 'Z' to all the dates, then it evaluates as false.
moment("2015-07-01Z").twix("2015-07-31Z", {allDay: true}).contains("2015-08-01Z");

Now one thing of importance is that the allDay flag is set to true, when setting that to false, then it does not matter if I use 'Z' or not, they both evaluate to false. (as they should)

Perhaps I am missing something, but this doesn't produce the behavior I was expecting. It was my understanding that it should be evaluating to see if Aug 1st is contained in the date range 2015-07-01 00:00:00 to 2015-07-31 23:59:59. It shouldn't matter if I use the local timezone or UTC, as long as they are all using the same timezone.

Tested with Moment 2.10.6 & Twix 0.6.4

2015-07-31 21_08_03-developer tools - https___dev ideatek com_wallaby_v3_invoice_

Wrong behavior in node js when another module depends from old moment version

Steps to reproduce:

  1. Create simple node js app. I use node version 0.10.38
  2. Install latest versions of moment (2.10.2), twix(0.6.3) and any module that depends from old moment version. I use file-stream-rotator module. This module requires moment version 2.3.1
  3. Require this modules in next order:
var moment = require('moment');
var FileStreamRotator = require('file-stream-rotator');
var twix = require('twix');

After starting app, you got error

[TypeError: Object function (input, format, lang, strict) {
        if (typeof(lang) === "boolean") {
            strict = lang;
            lang = undefined;
        }
        return makeMoment({
            _i : input,
            _f : format,
            _l : lang,
            _strict : strict,
            _isUTC : false
        });
    } has no method 'locale']

It occurs, because Twix will be initialized twice:

if (hasModule) {  
    module.exports = makeTwix(require("moment"));
  }
else if (typeof moment !== "undefined" && moment !== null) {    
    this.Twix = makeTwix(moment);
  }

You can check it also here

Incompatibility with moment 2.8.4

Recently updated our moment dependency and we found a strange behaviour on our website.

moment().twix(moment().add(15, 'days')).iterate('days')

never returns.

has anyone noticed a similar behaviour using twix 0.5.1 and moment 2.8.4?

removing moment 2.8.4 and twix and reinstalling moment 2.8.3 seems to fix the problem.

Incompatible with momentjs 2.10.0 in Meteor

To reproduce:

meteor create test
cd test
meteor add momentjs:moment
meteor add momentjs:twix
meteor run
...
TypeError: Cannot set property '_twix' of undefined at Function.Twix._extend (packages/momentjs:twix/bin/twix.js:65:1)
...

I presume this is due to the ES6 refactoring.

Note that adding twix first will not cause an error, as Meteor will install momentjs 2.9 instead, due to that version being specified by twix.

The error is caused because twix's package.js specifies 2.9.0 or higher.

Therefore in the short term, I guess the easy fix is to edit https://github.com/icambron/twix.js/blob/develop/package.js#L16 to require version 2.9.0 exactly with an = sign. http://docs.meteor.com/#/full/pack_use

Update configuration of webhook for autopublish.meteor.com

Hi @icambron,
I've noticed that every new release triggers 2 publish operations on autopublish.meteor.com
I think the reason is the webhook was wrongly configured (not your fault....) to notify both new tags and new releases: since a new release also creates a new tag what we get is a double trigger and the second publish attempt usually fails with "Version already exists" error.

Could you please update the configuration to reflect what can be seen in this screenshot?
...you'll find the configuration page under Settings -> Webhoks & Services ;-)

It's not a big problem though...

humanizeLength() strict mode

moment("5/25/1982 8:00").twix("5/25/1982 09:29").humanizeLength() 

returns "one hour", needed as "one hour, 29 minutes"

moment("5/25/1982 8:00").twix("5/25/1982 09:31").humanizeLength()

returns "two hours", needed as "one hour, 31 minutes"

its based on on 30min

but with:

moment("5/25/1982 8:00").twix("5/25/1982 08:11").humanizeLength()

it gives "11 minutes" and its OK

moment("5/25/1982 8:00").twix("5/25/1982 08:44").humanizeLength()

it gives "44 minutes" and its OK

but with

moment("5/25/1982 8:00").twix("5/25/1982 08:45").humanizeLength()

its gives "one hour" needed as "45 minutes"

its based on 15min

it is possible?

Does twix work with moment-timezone

Hello,

I'm currently using moment-timezone, and cannot get twix work with it. Did I miss something, or twix does not work with moment-timezone?

var moment  = require('moment-timezone');
require('twix');

var a = moment("1982-05-25 05:00:00").twix("1982-05-25 06:00:00").count("days");
console.log(a);

When I run code above I get:

var a = moment("1982-05-25 05:00:00").twix("1982-05-25 06:00:00").count("days"
                                  ^
TypeError: undefined is not a function

Internationalization formatting day/month swap

Great library, Isaac, many thanks.
On the internationalization topic, twix uses the moment locale's settings by default, but not on the order of the day/month.

moment().locale('us').format('LLL'); //=> "February 1, 2016 5:30 PM"
moment().locale('en-gb').format('LLL'); //=> "1 February 2016 17:30"

With twix:
moment.locale('en-gb');
moment('2017-02-01').twix('2017-02-01',{allDay: true}).format(); => "Feb 1, 2017"

But I believe it should be: "1 Feb 2017"

Many thanks

Amir

raw.github.com going away.

I see your docs instruct users to hotlink https://raw.github.com/icambron/twix.js/master/bin/twix.min.js. Not a good idea, since this will (soon if not already) fail on most browsers. Github added the no-sniff header added to prevent hotlinking.

I find rawgithub.com / raw.github.com is often used as a CDN so files are not locally hosted. IMHO http://cdnjs.com/ should be used in this case. Very very rarely (aside from testing on jsperf) is a fresh copy from github is needed & even then it takes only seconds to download locally & use.

edited first line

isValid() does not take locale into account

It seems that twix isValid() does not check the validity of the moment objects themselves.
Moment 2.10.6
Twix 0.7.2

Consider the following:

> var moment = require('moment')
undefined
> require('twix')
{ [Function: Twix] _extend: [Function], formatTemplate: [Function] }
> moment.locale('es')
'es'
> var start = moment('15 Aug 2015', 'DD MMM YYYY')
undefined
> start.isValid()
false
> var end = moment('20 Aug 2015', 'DD MMM YYYY')
undefined
> end.isValid()
false
> var range = start.twix(end)
undefined
> range.format()
'Invalid date, Invalid date'
> range.isValid()
true
>
> start
{ [Number: 1421272800000]
  _isAMomentObject: true,
  _i: '15 Aug 2015',
  _f: 'DD MMM YYYY',
  _isUTC: false,
  _pf: 
   { empty: false,
     unusedTokens: [],
     unusedInput: [],
     overflow: -1,
     charsLeftOver: 0,
     nullInput: false,
     invalidMonth: 'Aug',
     invalidFormat: false,
     userInvalidated: false,
     iso: false },
  _locale: 
   { _months: 
      [ 'Enero',
        'Febrero',
        'Marzo',
        'Abril',
        'Mayo',
        'Junio',
        'Julio',
        'Agosto',
        'Septiembre',
        'Octubre',
        'Noviembre',
        'Diciembre' ],
     monthsShort: [Function],
     _weekdays: 
      [ 'Domingo',
        'Lunes',
        'Martes',
        'Miércoles',
        'Jueves',
        'Viernes',
        'Sábado' ],
     _weekdaysShort: [ 'Dom.', 'Lun.', 'Mar.', 'Mié.', 'Jue.', 'Vie.', 'Sáb.' ],
     _weekdaysMin: [ 'Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá' ],
     _longDateFormat: 
      { LT: 'H:mm',
        LTS: 'H:mm:ss',
        L: 'DD/MM/YYYY',
        LL: 'D [de] MMMM [de] YYYY',
        LLL: 'D [de] MMMM [de] YYYY H:mm',
        LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm' },
     _calendar: 
      { sameDay: [Function],
        nextDay: [Function],
        nextWeek: [Function],
        lastDay: [Function],
        lastWeek: [Function],
        sameElse: 'L' },
     _relativeTime: 
      { future: 'en %s',
        past: 'hace %s',
        s: 'unos segundos',
        m: 'un minuto',
        mm: '%d minutos',
        h: 'una hora',
        hh: '%d horas',
        d: 'un día',
        dd: '%d días',
        M: 'un mes',
        MM: '%d meses',
        y: 'un año',
        yy: '%d años' },
     _ordinalParse: /\d{1,2}º/,
     _ordinal: '%dº',
     _week: { dow: 1, doy: 4 },
     _abbr: 'es',
     _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
     _monthsParse: 
      [ /^Enero|^Ene/i,
        /^Febrero|^Feb/i,
        /^Marzo|^Mar/i,
        /^Abril|^Abr/i,
        /^Mayo|^May/i,
        /^Junio|^Jun/i,
        /^Julio|^Jul/i,
        /^Agosto|^Ago/i,
        /^Septiembre|^Sep/i,
        /^Octubre|^Oct/i,
        /^Noviembre|^Nov/i,
        /^Diciembre|^Dic/i ],
     _longMonthsParse: [],
     _shortMonthsParse: [] },
  _d: Thu Jan 15 2015 00:00:00 GMT+0200 (EET),
  _isValid: false }
>
> range
{ start: 
   { [Number: 1421272800000]
     _isAMomentObject: true,
     _i: '15 Aug 2015',
     _f: 'DD MMM YYYY',
     _isUTC: false,
     _pf: 
      { empty: false,
        unusedTokens: [],
        unusedInput: [],
        overflow: -1,
        charsLeftOver: 0,
        nullInput: false,
        invalidMonth: 'Aug',
        invalidFormat: false,
        userInvalidated: false,
        iso: false },
     _locale: 
      { _months: [Object],
        monthsShort: [Function],
        _weekdays: [Object],
        _weekdaysShort: [Object],
        _weekdaysMin: [Object],
        _longDateFormat: [Object],
        _calendar: [Object],
        _relativeTime: [Object],
        _ordinalParse: /\d{1,2}º/,
        _ordinal: '%dº',
        _week: [Object],
        _abbr: 'es',
        _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
        _monthsParse: [Object],
        _longMonthsParse: [],
        _shortMonthsParse: [] },
     _d: Thu Jan 15 2015 00:00:00 GMT+0200 (EET),
     _isValid: false },
  end: 
   { [Number: 1421704800000]
     _isAMomentObject: true,
     _i: '20 Aug 2015',
     _f: 'DD MMM YYYY',
     _isUTC: false,
     _pf: 
      { empty: false,
        unusedTokens: [],
        unusedInput: [],
        overflow: -1,
        charsLeftOver: 0,
        nullInput: false,
        invalidMonth: 'Aug',
        invalidFormat: false,
        userInvalidated: false,
        iso: false },
     _locale: 
      { _months: [Object],
        monthsShort: [Function],
        _weekdays: [Object],
        _weekdaysShort: [Object],
        _weekdaysMin: [Object],
        _longDateFormat: [Object],
        _calendar: [Object],
        _relativeTime: [Object],
        _ordinalParse: /\d{1,2}º/,
        _ordinal: '%dº',
        _week: [Object],
        _abbr: 'es',
        _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
        _monthsParse: [Object],
        _longMonthsParse: [],
        _shortMonthsParse: [] },
     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),
     _isValid: false },
  allDay: false,
  _trueStart: 
   { [Number: 1421272800000]
     _isAMomentObject: true,
     _i: '15 Aug 2015',
     _f: 'DD MMM YYYY',
     _isUTC: false,
     _pf: 
      { empty: false,
        unusedTokens: [],
        unusedInput: [],
        overflow: -1,
        charsLeftOver: 0,
        nullInput: false,
        invalidMonth: 'Aug',
        invalidFormat: false,
        userInvalidated: false,
        iso: false },
     _locale: 
      { _months: [Object],
        monthsShort: [Function],
        _weekdays: [Object],
        _weekdaysShort: [Object],
        _weekdaysMin: [Object],
        _longDateFormat: [Object],
        _calendar: [Object],
        _relativeTime: [Object],
        _ordinalParse: /\d{1,2}º/,
        _ordinal: '%dº',
        _week: [Object],
        _abbr: 'es',
        _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
        _monthsParse: [Object],
        _longMonthsParse: [],
        _shortMonthsParse: [] },
     _d: Thu Jan 15 2015 00:00:00 GMT+0200 (EET),
     _isValid: false },
  _lastMilli: 
   { [Number: 1421704800000]
     _isAMomentObject: true,
     _i: '20 Aug 2015',
     _f: 'DD MMM YYYY',
     _isUTC: false,
     _pf: 
      { empty: false,
        unusedTokens: [],
        unusedInput: [],
        overflow: -1,
        charsLeftOver: 0,
        nullInput: false,
        invalidMonth: 'Aug',
        invalidFormat: false,
        userInvalidated: false,
        iso: false },
     _locale: 
      { _months: [Object],
        monthsShort: [Function],
        _weekdays: [Object],
        _weekdaysShort: [Object],
        _weekdaysMin: [Object],
        _longDateFormat: [Object],
        _calendar: [Object],
        _relativeTime: [Object],
        _ordinalParse: /\d{1,2}º/,
        _ordinal: '%dº',
        _week: [Object],
        _abbr: 'es',
        _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
        _monthsParse: [Object],
        _longMonthsParse: [],
        _shortMonthsParse: [] },
     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),
     _isValid: false },
  _transferrableEnd: 
   { [Number: 1421704800000]
     _isAMomentObject: true,
     _i: '20 Aug 2015',
     _f: 'DD MMM YYYY',
     _isUTC: false,
     _pf: 
      { empty: false,
        unusedTokens: [],
        unusedInput: [],
        overflow: -1,
        charsLeftOver: 0,
        nullInput: false,
        invalidMonth: 'Aug',
        invalidFormat: false,
        userInvalidated: false,
        iso: false },
     _locale: 
      { _months: [Object],
        monthsShort: [Function],
        _weekdays: [Object],
        _weekdaysShort: [Object],
        _weekdaysMin: [Object],
        _longDateFormat: [Object],
        _calendar: [Object],
        _relativeTime: [Object],
        _ordinalParse: /\d{1,2}º/,
        _ordinal: '%dº',
        _week: [Object],
        _abbr: 'es',
        _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
        _monthsParse: [Object],
        _longMonthsParse: [],
        _shortMonthsParse: [] },
     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),
     _isValid: false },
  _displayEnd: 
   { [Number: 1421704800000]
     _isAMomentObject: true,
     _i: '20 Aug 2015',
     _f: 'DD MMM YYYY',
     _isUTC: false,
     _pf: 
      { empty: false,
        unusedTokens: [],
        unusedInput: [],
        overflow: -1,
        charsLeftOver: 0,
        nullInput: false,
        invalidMonth: 'Aug',
        invalidFormat: false,
        userInvalidated: false,
        iso: false },
     _locale: 
      { _months: [Object],
        monthsShort: [Function],
        _weekdays: [Object],
        _weekdaysShort: [Object],
        _weekdaysMin: [Object],
        _longDateFormat: [Object],
        _calendar: [Object],
        _relativeTime: [Object],
        _ordinalParse: /\d{1,2}º/,
        _ordinal: '%dº',
        _week: [Object],
        _abbr: 'es',
        _ordinalParseLenient: /\d{1,2}º|\d{1,2}/,
        _monthsParse: [Object],
        _longMonthsParse: [],
        _shortMonthsParse: [] },
     _d: Tue Jan 20 2015 00:00:00 GMT+0200 (EET),
     _isValid: false } }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.