Skip to content

Conversation

mathiasschopmans
Copy link

@mathiasschopmans mathiasschopmans commented Oct 27, 2016

Version 1.3.0

Starting from this version you can return real Date-Objects if convertJsonDates is set to true

var tp = require('tp-api')({
  domain: 'domain.tld',
  token: 'abc'
  convertJsonDates: true
});

tp('Tasks')
  .take(3)
  .pluck('Name', 'StartDate')
  .then((err, tasks) => {
    if (err)  return console.log('err', err);
    tasks.forEach(function(t) {
      console.log( t.Id + ' :: ' + (t.StartDate.getMonth() + 1) + '-' + t.StartDate.getDate() + '-' + t.StartDate.getFullYear() + ' :: ' + t.Name );
      /*
        Outputs:
        85299 :: 12-8-2015 :: Task 1
        100853 :: 6-14-2016 :: Task 2
        85708 :: 1-4-2016 :: Task 3
       */
    })
  });

@8bitDesigner
Copy link
Owner

Oh this is fantastic! Sorry, I've been out of the country for the last few months and only now seeing this. Unfortunately I don't use TargetProcess any more, so I have no way to test this, do you want contributor access on this repo so you can merge and publish this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants