WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Displaying wrong day if use 'j'

[Resolved] Displaying wrong day if use 'j'

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Boštjan Cigan

    @zerocool51

    Which date format were you using?

    When you pasted the date format here there is no jS there. Please paste the whole format that “screwed” the date up, so that I can debug it more easily.

    Cheers.

    Ok, the date format I want to use is: F j, Y g:i a

    … where “j” is showing the wrong day number.

    I’m running into the same problem in version 3.0. I dug into the twitget/twitget.php file in the plugin and found this part of the code:

    // The array for converting PHP formatted date to moment.js date
    global $twitget_time_array;
    $twitget_time_array = array(
    	"d" => "MM", // 01 - 31 day of the month
    	"D" => "ddd", // Mon through Sun
    	"j" => "M", // 1 to 31 day of the month without zeroes

    If you look at the moment.js documentation, however, those conversions are incorrect. The day tokens are actually getting replaced with month tokens. In that snippet of code above, “d” should really go to “DD” and “j” should really go to “D” in order to convert the values properly.

    Plugin Author Boštjan Cigan

    @zerocool51

    Thank you!

    I’ve been really busy lately with my work, so I haven’t had the time yet to resolve some support threads.

    Marking as resolved, I’ll commit it when I resolve the other threads as well.

    Again thanks.

    Cheers.

    Thank you very much, scuddr! That fixed it. Now is showing the correct day number instead of the month number.

    No problem Boštjan, awesome plugin anyway 😉 Just include this fix in the next version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Displaying wrong day if use 'j'’ is closed to new replies.