Click here to Skip to main content
15,910,118 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: I've been moderated... Pin
Afzaal Ahmad Zeeshan27-Jul-15 3:49
professionalAfzaal Ahmad Zeeshan27-Jul-15 3:49 
GeneralRe: I've been moderated... Pin
Slacker00727-Jul-15 4:06
professionalSlacker00727-Jul-15 4:06 
GeneralRe: I've been moderated... Pin
charlieg27-Jul-15 5:17
charlieg27-Jul-15 5:17 
RantJavascript and Dates Pin
Marc Clifton27-Jul-15 3:06
mvaMarc Clifton27-Jul-15 3:06 
GeneralRe: Javascript and Dates Pin
HobbyProggy27-Jul-15 3:12
professionalHobbyProggy27-Jul-15 3:12 
GeneralRe: Javascript and Dates Pin
908236527-Jul-15 3:20
908236527-Jul-15 3:20 
GeneralRe: Javascript and Dates Pin
Kaushik S Murthy27-Jul-15 3:25
Kaushik S Murthy27-Jul-15 3:25 
GeneralRe: Javascript and Dates Pin
Marc Clifton27-Jul-15 3:42
mvaMarc Clifton27-Jul-15 3:42 
Happily I'm not using node. I'm just using the javascript Date object, and that only to fix the damn date handling. So now I have code like this:
function fixupDates(data, view) {
    for (var i = 0; i < data.length; i++) {
        var row = data[i]
        for (var j = 0; j < view.fields.length; j++) {
            var field = view.fields[j]

            // Fixup for stupid Javascript, which adjusts the date because the time is 0 Zulu and it's 
            // compensating for DST or the timezone or both.  Whatever the reason, this is BULLSHIT.
            if (field.type == "date") {
                var dateval = row[field.name]
                if (dateval.length >= 10) {
                    var year = dateval.substring(0, 4)
                    var month = dateval.substring(5, 7)
                    var day = dateval.substring(8, 10)
                    // Who is total sh*t for brains idiot in Javascript that decided months should begin at month 0???
                    row[field.name] = new Date(year, month - 1, day)
                }
            }
        }
    }
}

Which as to walk through every f*cking row of the dataset that I just AJAX loaded!

Thankfully, because I use the same library for loading grid data and because I have the view definition in the javascript, I've only needed to fix this once and it fixes all my grids where a data field is rendered (BTW, I'm using jqxGrid)

Marc

GeneralRe: Javascript and Dates Pin
Kornfeld Eliyahu Peter27-Jul-15 3:57
professionalKornfeld Eliyahu Peter27-Jul-15 3:57 
GeneralRe: Javascript and Dates Pin
Mario Vernari27-Jul-15 3:47
Mario Vernari27-Jul-15 3:47 
QuestionRe: Javascript and Dates Pin
Jeremy Falcon27-Jul-15 4:32
professionalJeremy Falcon27-Jul-15 4:32 
AnswerRe: Javascript and Dates Pin
Marc Clifton27-Jul-15 6:28
mvaMarc Clifton27-Jul-15 6:28 
GeneralRe: Javascript and Dates Pin
Jeremy Falcon27-Jul-15 6:49
professionalJeremy Falcon27-Jul-15 6:49 
GeneralRe: Javascript and Dates Pin
Brady Kelly27-Jul-15 5:40
Brady Kelly27-Jul-15 5:40 
GeneralRe: Javascript and Dates Pin
dandy7227-Jul-15 6:25
dandy7227-Jul-15 6:25 
GeneralRe: Javascript and Dates Pin
Bruce Patin28-Jul-15 4:18
Bruce Patin28-Jul-15 4:18 
GeneralRe: Javascript and Dates Pin
dandy7228-Jul-15 12:45
dandy7228-Jul-15 12:45 
GeneralRe: Javascript and Dates Pin
Bruce Patin30-Jul-15 3:26
Bruce Patin30-Jul-15 3:26 
GeneralRe: Javascript and Dates Pin
dandy7230-Jul-15 6:41
dandy7230-Jul-15 6:41 
GeneralRe: Javascript and Dates Pin
James Lonero28-Jul-15 12:46
James Lonero28-Jul-15 12:46 
GeneralRe: Javascript and Dates Pin
dandy7228-Jul-15 12:49
dandy7228-Jul-15 12:49 
GeneralRe: Javascript and Dates Pin
Kent Sharkey27-Jul-15 13:11
staffKent Sharkey27-Jul-15 13:11 
GeneralRe: Javascript and Dates Pin
scmtim28-Jul-15 4:55
scmtim28-Jul-15 4:55 
GeneralRe: Javascript and Dates Pin
Leng Vang28-Jul-15 6:30
Leng Vang28-Jul-15 6:30 
GeneralRe: Javascript and Dates Pin
Marc Clifton28-Jul-15 8:14
mvaMarc Clifton28-Jul-15 8:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.