parsing DBF files and excluding lines that have a set date condition

94 views Asked by At

i have the following code:

parseAccountRecord = (dbfr) ->
  # We parse all records
  yesterday = moment().subtract(1,'days')
  createdAt = new moment(dbfr.SN_FCREATE, "YYYYMMDD")
  lastCreated = yesterday.diff(createdAt, 'days')
  updatedAt = new moment(dbfr.SN_LUPDATE, "YYYYMMDD")
  lastUpdated = yesterday.diff(updatedAt, 'days')
  if dbfr['@deleted'] or lastUpdated > 2 or lastCreated  > 2 then return null

basically i want to exclude all records with a lastUpdate date two days older or last created dates two days older from the set?

what am i missing?

any advice much appreciated.

0

There are 0 answers