• Hi,
    All the dates provided by WordPress are correct with the exception of the date created by the datetime variable of the <ins> quicktag, which is one month early. For example, I got this when I added an insertion to a post on August 30th:
    <ins title="Added at 2004-7-30 at 14:23:35-4:00" datetime="2004-7-30T14:23:35-4:00">
    Note that I edited the <ins> tag, as you can see, but I don’t think I changed anything that would affect this. The relevant lines from my quicktags.js file are as follows:

    var now = new Date();
    var datetime = now.getFullYear() + '-' + now.getMonth() + '-' + now.getDate() + 'T' +
    now.getHours() + ':' + now.getMinutes() + ':' +
    now.getSeconds() + '-' + (now.getTimezoneOffset()/60)
    + ':' + '00';

    Do others have this problem? Is there a way to fix it?
    Thanks,
    Strunk

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter strunk

    (@strunk)

    That must be it. It seems odd to me that months would be zero-based and days wouldn’t . . .
    Anyway, would someone mind posting and telling me how to add one to the number returned by the function, since I know no JS?
    Thank you,
    S.

    easy, change the line to this:

    var datetime = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + 'T' +
    now.getHours() + ':' + now.getMinutes() + ':' +
    now.getSeconds() + '-' + (now.getTimezoneOffset()/60)
    + ':' + '00';

    TG

    Thread Starter strunk

    (@strunk)

    Awesome, worked like a charm.
    One other thing I noticed that someone might want to change at some point is that times are given without leading zeros; for example nine minutes and seven seconds past five PM displays as 17:9:7.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wrong month in quicktag.js only’ is closed to new replies.