Different dates being returned depending on regionIs the Javascript date object always one day off?How to return only the Date from a SQL Server DateTime datatypeCompare two dates with JavaScriptWhat's the difference between using “let” and “var”?Where can I find documentation on formatting a date in JavaScript?Detecting an “invalid date” Date instance in JavaScriptevent.preventDefault() vs. return falseHow do I get the current date in JavaScript?What is the difference between call and apply?How to format a JavaScript dateHow do I return the response from an asynchronous call?

How to extract coefficients of a generating function like this one, using a computer?

Is it OK to say "The situation is pregnant with a crisis"?

Variable declaration inside main loop

Are the Gray and Death Slaad's Bite and Claw attacks magical?

Is this house-rule removing the increased effect of cantrips at higher character levels balanced?

Finding an optimal set without forbidden subsets

How soon after takeoff can you recline your airplane seat?

Are there advantages in writing by hand over typing out a story?

Are the plates of a battery really charged?

Why is my 401k manager recommending me to save more?

What is the point of using the kunai?

What's the difference between the Find Steed and Find Greater Steed spells?

Why can't i use !(single pattern) in zsh even after i turn on kshglob?

What verb goes with "coup"?

Old story where computer expert digitally animates The Lord of the Rings

Trace in the category of propositional statements

What is this fluorinated organic substance?

What is the function of const specifier in enum types?

Did the Shuttle payload bay have illumination?

Are all notation equal by derivatives?

GFCI versus circuit breaker

What does this Pokemon Trainer mean by saying the player is "SHELLOS"?

A world with roman numeral alphabet

Disk usage confusion: 10G missing on Linux home partition on SSD



Different dates being returned depending on region


Is the Javascript date object always one day off?How to return only the Date from a SQL Server DateTime datatypeCompare two dates with JavaScriptWhat's the difference between using “let” and “var”?Where can I find documentation on formatting a date in JavaScript?Detecting an “invalid date” Date instance in JavaScriptevent.preventDefault() vs. return falseHow do I get the current date in JavaScript?What is the difference between call and apply?How to format a JavaScript dateHow do I return the response from an asynchronous call?













1















I have a function in Javascript that returns the date ranges of the current/previous/next quarter. For example, for current quarter it would return 2019-01-01 and 2019-03-31. For some reason, a few colleagues have said that the date ranges are inaccurate for them: for them it returns 2018-12-31 and 2019-02-27. I noticed that both of these users are in Germany/Poland region.



Here is my jsFiddle



function formatDate(date) 
var d = new Date(date),
month = '' + (d.getUTCMonth() + 1),
day = '' + d.getUTCDate(),
year = d.getUTCFullYear();

if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;

return [year, month, day].join('-');


function getDate_FQ(range)
var now = new Date();
switch(range)
case 'Previous FQ':
now.setMonth(now.getMonth()-3);
break;
case 'Next FQ':
now.setMonth(now.getMonth()+3);
break;
case 'Current FQ':
break;

var quarter = Math.floor((now.getUTCMonth() / 3));
var firstDate = new Date(now.getUTCFullYear(), quarter * 3, 1);
var endDate = new Date(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0);
return([firstDate, endDate])


let [first, end] = getDate_FQ('Current FQ')
console.log(formatDate(first), formatDate(end))


How is it that one date is off by 1 day and the other is off by 1 month and 1 day?










share|improve this question






















  • The problem is that you are mixing local and UTC methods. Just use one or the other exclusively..

    – RobG
    Mar 25 at 21:09






  • 1





    formatDate can be simplified to new Date(date).toISOString().split('T')[0] if I'm not mistaken.

    – 3limin4t0r
    Mar 25 at 21:10











  • Possible duplicate of Is the Javascript date object always one day off?

    – Heretic Monkey
    Mar 25 at 21:39















1















I have a function in Javascript that returns the date ranges of the current/previous/next quarter. For example, for current quarter it would return 2019-01-01 and 2019-03-31. For some reason, a few colleagues have said that the date ranges are inaccurate for them: for them it returns 2018-12-31 and 2019-02-27. I noticed that both of these users are in Germany/Poland region.



Here is my jsFiddle



function formatDate(date) 
var d = new Date(date),
month = '' + (d.getUTCMonth() + 1),
day = '' + d.getUTCDate(),
year = d.getUTCFullYear();

if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;

return [year, month, day].join('-');


function getDate_FQ(range)
var now = new Date();
switch(range)
case 'Previous FQ':
now.setMonth(now.getMonth()-3);
break;
case 'Next FQ':
now.setMonth(now.getMonth()+3);
break;
case 'Current FQ':
break;

var quarter = Math.floor((now.getUTCMonth() / 3));
var firstDate = new Date(now.getUTCFullYear(), quarter * 3, 1);
var endDate = new Date(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0);
return([firstDate, endDate])


let [first, end] = getDate_FQ('Current FQ')
console.log(formatDate(first), formatDate(end))


How is it that one date is off by 1 day and the other is off by 1 month and 1 day?










share|improve this question






















  • The problem is that you are mixing local and UTC methods. Just use one or the other exclusively..

    – RobG
    Mar 25 at 21:09






  • 1





    formatDate can be simplified to new Date(date).toISOString().split('T')[0] if I'm not mistaken.

    – 3limin4t0r
    Mar 25 at 21:10











  • Possible duplicate of Is the Javascript date object always one day off?

    – Heretic Monkey
    Mar 25 at 21:39













1












1








1








I have a function in Javascript that returns the date ranges of the current/previous/next quarter. For example, for current quarter it would return 2019-01-01 and 2019-03-31. For some reason, a few colleagues have said that the date ranges are inaccurate for them: for them it returns 2018-12-31 and 2019-02-27. I noticed that both of these users are in Germany/Poland region.



Here is my jsFiddle



function formatDate(date) 
var d = new Date(date),
month = '' + (d.getUTCMonth() + 1),
day = '' + d.getUTCDate(),
year = d.getUTCFullYear();

if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;

return [year, month, day].join('-');


function getDate_FQ(range)
var now = new Date();
switch(range)
case 'Previous FQ':
now.setMonth(now.getMonth()-3);
break;
case 'Next FQ':
now.setMonth(now.getMonth()+3);
break;
case 'Current FQ':
break;

var quarter = Math.floor((now.getUTCMonth() / 3));
var firstDate = new Date(now.getUTCFullYear(), quarter * 3, 1);
var endDate = new Date(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0);
return([firstDate, endDate])


let [first, end] = getDate_FQ('Current FQ')
console.log(formatDate(first), formatDate(end))


How is it that one date is off by 1 day and the other is off by 1 month and 1 day?










share|improve this question














I have a function in Javascript that returns the date ranges of the current/previous/next quarter. For example, for current quarter it would return 2019-01-01 and 2019-03-31. For some reason, a few colleagues have said that the date ranges are inaccurate for them: for them it returns 2018-12-31 and 2019-02-27. I noticed that both of these users are in Germany/Poland region.



Here is my jsFiddle



function formatDate(date) 
var d = new Date(date),
month = '' + (d.getUTCMonth() + 1),
day = '' + d.getUTCDate(),
year = d.getUTCFullYear();

if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;

return [year, month, day].join('-');


function getDate_FQ(range)
var now = new Date();
switch(range)
case 'Previous FQ':
now.setMonth(now.getMonth()-3);
break;
case 'Next FQ':
now.setMonth(now.getMonth()+3);
break;
case 'Current FQ':
break;

var quarter = Math.floor((now.getUTCMonth() / 3));
var firstDate = new Date(now.getUTCFullYear(), quarter * 3, 1);
var endDate = new Date(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0);
return([firstDate, endDate])


let [first, end] = getDate_FQ('Current FQ')
console.log(formatDate(first), formatDate(end))


How is it that one date is off by 1 day and the other is off by 1 month and 1 day?







javascript date datetime datetime-format






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 17:23









BijanBijan

3,6248 gold badges44 silver badges83 bronze badges




3,6248 gold badges44 silver badges83 bronze badges












  • The problem is that you are mixing local and UTC methods. Just use one or the other exclusively..

    – RobG
    Mar 25 at 21:09






  • 1





    formatDate can be simplified to new Date(date).toISOString().split('T')[0] if I'm not mistaken.

    – 3limin4t0r
    Mar 25 at 21:10











  • Possible duplicate of Is the Javascript date object always one day off?

    – Heretic Monkey
    Mar 25 at 21:39

















  • The problem is that you are mixing local and UTC methods. Just use one or the other exclusively..

    – RobG
    Mar 25 at 21:09






  • 1





    formatDate can be simplified to new Date(date).toISOString().split('T')[0] if I'm not mistaken.

    – 3limin4t0r
    Mar 25 at 21:10











  • Possible duplicate of Is the Javascript date object always one day off?

    – Heretic Monkey
    Mar 25 at 21:39
















The problem is that you are mixing local and UTC methods. Just use one or the other exclusively..

– RobG
Mar 25 at 21:09





The problem is that you are mixing local and UTC methods. Just use one or the other exclusively..

– RobG
Mar 25 at 21:09




1




1





formatDate can be simplified to new Date(date).toISOString().split('T')[0] if I'm not mistaken.

– 3limin4t0r
Mar 25 at 21:10





formatDate can be simplified to new Date(date).toISOString().split('T')[0] if I'm not mistaken.

– 3limin4t0r
Mar 25 at 21:10













Possible duplicate of Is the Javascript date object always one day off?

– Heretic Monkey
Mar 25 at 21:39





Possible duplicate of Is the Javascript date object always one day off?

– Heretic Monkey
Mar 25 at 21:39










2 Answers
2






active

oldest

votes


















1














If you want to have Date refers to the same time in every timezone, work in UTC and change your code in two lines to:



var firstDate = new Date(Date.UTC(now.getUTCFullYear(), quarter * 3, 1));
var endDate = new Date(Date.UTC(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0));





share|improve this answer
































    0














    NaDeR Star posted a solution that solved my problem with the timezone but I found a method that was nearly twice as fast when running this 100K times.



    Since the dates of the quarter ranges are always the same (Jan1 - Mar31, Apr1 - Jun30, etc) and the only thing changing is the year, it is faster to just combine the year with the date range.



    Here is my new solution:



    function getDate_FQ(range)
    var now = new Date();
    var dateArr = 0: ['-01-01', '-03-31'], 1: ['-04-01', '-06-30'], 2: ['-07-01', '-09-30'], 3: ['-10-01', '-12-31']
    switch(range)
    case 'Previous FQ':
    now.setUTCMonth(now.getUTCMonth()-3);
    break;
    case 'Next FQ':
    now.setUTCMonth(now.getUTCMonth()+3);
    break;
    case 'Current FQ':
    break;

    var quarter = Math.floor((now.getUTCMonth() / 3));
    var dates = dateArr[quarter]
    var firstDate = (now.getUTCFullYear()) + dates[0];
    var endDate = (now.getUTCFullYear()) + dates[1];
    return([firstDate, endDate])






    share|improve this answer

























    • You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

      – RobG
      Mar 25 at 21:17












    • That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

      – 3limin4t0r
      Mar 25 at 21:32













    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343338%2fdifferent-dates-being-returned-depending-on-region%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If you want to have Date refers to the same time in every timezone, work in UTC and change your code in two lines to:



    var firstDate = new Date(Date.UTC(now.getUTCFullYear(), quarter * 3, 1));
    var endDate = new Date(Date.UTC(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0));





    share|improve this answer





























      1














      If you want to have Date refers to the same time in every timezone, work in UTC and change your code in two lines to:



      var firstDate = new Date(Date.UTC(now.getUTCFullYear(), quarter * 3, 1));
      var endDate = new Date(Date.UTC(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0));





      share|improve this answer



























        1












        1








        1







        If you want to have Date refers to the same time in every timezone, work in UTC and change your code in two lines to:



        var firstDate = new Date(Date.UTC(now.getUTCFullYear(), quarter * 3, 1));
        var endDate = new Date(Date.UTC(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0));





        share|improve this answer















        If you want to have Date refers to the same time in every timezone, work in UTC and change your code in two lines to:



        var firstDate = new Date(Date.UTC(now.getUTCFullYear(), quarter * 3, 1));
        var endDate = new Date(Date.UTC(firstDate.getUTCFullYear(), firstDate.getUTCMonth() + 3, 0));






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 25 at 18:16

























        answered Mar 25 at 18:10









        NaDeR StarNaDeR Star

        5971 gold badge5 silver badges13 bronze badges




        5971 gold badge5 silver badges13 bronze badges





















            0














            NaDeR Star posted a solution that solved my problem with the timezone but I found a method that was nearly twice as fast when running this 100K times.



            Since the dates of the quarter ranges are always the same (Jan1 - Mar31, Apr1 - Jun30, etc) and the only thing changing is the year, it is faster to just combine the year with the date range.



            Here is my new solution:



            function getDate_FQ(range)
            var now = new Date();
            var dateArr = 0: ['-01-01', '-03-31'], 1: ['-04-01', '-06-30'], 2: ['-07-01', '-09-30'], 3: ['-10-01', '-12-31']
            switch(range)
            case 'Previous FQ':
            now.setUTCMonth(now.getUTCMonth()-3);
            break;
            case 'Next FQ':
            now.setUTCMonth(now.getUTCMonth()+3);
            break;
            case 'Current FQ':
            break;

            var quarter = Math.floor((now.getUTCMonth() / 3));
            var dates = dateArr[quarter]
            var firstDate = (now.getUTCFullYear()) + dates[0];
            var endDate = (now.getUTCFullYear()) + dates[1];
            return([firstDate, endDate])






            share|improve this answer

























            • You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

              – RobG
              Mar 25 at 21:17












            • That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

              – 3limin4t0r
              Mar 25 at 21:32















            0














            NaDeR Star posted a solution that solved my problem with the timezone but I found a method that was nearly twice as fast when running this 100K times.



            Since the dates of the quarter ranges are always the same (Jan1 - Mar31, Apr1 - Jun30, etc) and the only thing changing is the year, it is faster to just combine the year with the date range.



            Here is my new solution:



            function getDate_FQ(range)
            var now = new Date();
            var dateArr = 0: ['-01-01', '-03-31'], 1: ['-04-01', '-06-30'], 2: ['-07-01', '-09-30'], 3: ['-10-01', '-12-31']
            switch(range)
            case 'Previous FQ':
            now.setUTCMonth(now.getUTCMonth()-3);
            break;
            case 'Next FQ':
            now.setUTCMonth(now.getUTCMonth()+3);
            break;
            case 'Current FQ':
            break;

            var quarter = Math.floor((now.getUTCMonth() / 3));
            var dates = dateArr[quarter]
            var firstDate = (now.getUTCFullYear()) + dates[0];
            var endDate = (now.getUTCFullYear()) + dates[1];
            return([firstDate, endDate])






            share|improve this answer

























            • You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

              – RobG
              Mar 25 at 21:17












            • That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

              – 3limin4t0r
              Mar 25 at 21:32













            0












            0








            0







            NaDeR Star posted a solution that solved my problem with the timezone but I found a method that was nearly twice as fast when running this 100K times.



            Since the dates of the quarter ranges are always the same (Jan1 - Mar31, Apr1 - Jun30, etc) and the only thing changing is the year, it is faster to just combine the year with the date range.



            Here is my new solution:



            function getDate_FQ(range)
            var now = new Date();
            var dateArr = 0: ['-01-01', '-03-31'], 1: ['-04-01', '-06-30'], 2: ['-07-01', '-09-30'], 3: ['-10-01', '-12-31']
            switch(range)
            case 'Previous FQ':
            now.setUTCMonth(now.getUTCMonth()-3);
            break;
            case 'Next FQ':
            now.setUTCMonth(now.getUTCMonth()+3);
            break;
            case 'Current FQ':
            break;

            var quarter = Math.floor((now.getUTCMonth() / 3));
            var dates = dateArr[quarter]
            var firstDate = (now.getUTCFullYear()) + dates[0];
            var endDate = (now.getUTCFullYear()) + dates[1];
            return([firstDate, endDate])






            share|improve this answer















            NaDeR Star posted a solution that solved my problem with the timezone but I found a method that was nearly twice as fast when running this 100K times.



            Since the dates of the quarter ranges are always the same (Jan1 - Mar31, Apr1 - Jun30, etc) and the only thing changing is the year, it is faster to just combine the year with the date range.



            Here is my new solution:



            function getDate_FQ(range)
            var now = new Date();
            var dateArr = 0: ['-01-01', '-03-31'], 1: ['-04-01', '-06-30'], 2: ['-07-01', '-09-30'], 3: ['-10-01', '-12-31']
            switch(range)
            case 'Previous FQ':
            now.setUTCMonth(now.getUTCMonth()-3);
            break;
            case 'Next FQ':
            now.setUTCMonth(now.getUTCMonth()+3);
            break;
            case 'Current FQ':
            break;

            var quarter = Math.floor((now.getUTCMonth() / 3));
            var dates = dateArr[quarter]
            var firstDate = (now.getUTCFullYear()) + dates[0];
            var endDate = (now.getUTCFullYear()) + dates[1];
            return([firstDate, endDate])







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 25 at 21:36









            3limin4t0r

            3,6108 silver badges23 bronze badges




            3,6108 silver badges23 bronze badges










            answered Mar 25 at 20:47









            BijanBijan

            3,6248 gold badges44 silver badges83 bronze badges




            3,6248 gold badges44 silver badges83 bronze badges












            • You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

              – RobG
              Mar 25 at 21:17












            • That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

              – 3limin4t0r
              Mar 25 at 21:32

















            • You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

              – RobG
              Mar 25 at 21:17












            • That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

              – 3limin4t0r
              Mar 25 at 21:32
















            You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

            – RobG
            Mar 25 at 21:17






            You are mixing local and UTC dates and will still get incorrect results for some dates at the very end or start of a quarter due to local timezone differences. E.g. for some one in UTC +10 and at 23:00 on 31 Dec 2018 this function returns the previous quarter as 2018-10-10 to 2018-12-31, which is incorrect.

            – RobG
            Mar 25 at 21:17














            That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

            – 3limin4t0r
            Mar 25 at 21:32





            That depends what you want. If you're working with UTC time, you'll get the UTC quarter. Not your local quarter.

            – 3limin4t0r
            Mar 25 at 21:32

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343338%2fdifferent-dates-being-returned-depending-on-region%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript