steem-js icon indicating copy to clipboard operation
steem-js copied to clipboard

steem.api.getDiscussionsByAuthorBeforeDate ignores the date

Open msg768 opened this issue 8 years ago • 7 comments

steem.api.getDiscussionsByAuthorBeforeDate(author, startPermlink, '2017-05-01T00:00:00', 10, function(err, result) { console.log(err, result); });

Expected behavior

It should return the latest 10 posts before 2017-05-01T00:00:00.

Actual behavior

It returns the latest 10 posts before now! The second parameter doesn't work properly either. If you try putting in the start of similar permlinks, it will return posts that do not start with startPermLink!

msg768 avatar Jul 21 '17 18:07 msg768

I have a similar problem with getDiscussionsByAuthorBeforeDate. startPermLink and beforeDate does not work!

junkcoin avatar Oct 28 '17 19:10 junkcoin

You need to pass it a good date. Check out this example that works:

getAuthorPosts("adamkokesh", "");
getAuthorPosts("adamkokesh", "xog6wlno");
function getAuthorPosts(author, lastPermlink){
	var now = new Date();
	console.log(dateFormat(now, "yyyy-mm-dd'T'HH:MM:ss"));
	steem.api.getDiscussionsByAuthorBeforeDate(author,lastPermlink,dateFormat(now, "yyyy-mm-dd'T'HH:MM:ss"),5, function(err, result) {
		  console.log(err,result);
	});
}

it starts by getting the first 5 posts and I have it hardcoded to get the next 5 based on a hardcoded permlink

date.format found here: http://stevenlevithan.com/assets/misc/date.format.js

powerpoint45 avatar Nov 21 '17 20:11 powerpoint45

dateFormat(now, "yyyy-mm-dd'T'HH:MM:ss") it starts by getting the first 5 posts and I have it hardcoded to get the next 5 based on a hardcoded > > permlink

date.format found here: http://stevenlevithan.com/assets/misc/date.format.js

Huh???

new Date().toJSON().substr(0, 19)

Produces:

"2018-01-01T13:24:02"

to generate permlink for post: new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase() + '-post',

to generate permlink for comment: steem.formatter.commentPermlink(author, permalink),

This work for me. Do you see any problems with this?

azarus avatar Jan 01 '18 13:01 azarus

You need to pass it a good date. Check out this example that works:

Can you tell me what's wrong with my date? You're sending the same format I'm sending as far as I can tell. You're also sending the current date so your exmple doesn't help because no matter what date I send in, it ignores it and instead uses the current date.

msg768 avatar Aug 18 '18 15:08 msg768

I think i meant that as a response to junkcoin. It's been a while..

powerpoint45 avatar Aug 18 '18 19:08 powerpoint45

I guess the issue is still there. Did you find a solution for this @msg768 ?

bala-techguy avatar Apr 21 '19 07:04 bala-techguy

Why is it that getDiscussionsByAuthorBeforeDate produces an error now no matter what the parameters? I'm getting : {"name":"RPCError","code":-32603,"data":{"error_id":"04b0b636-b655-472b-ad34-0eafdba62f08","jussi_request_id":"000664238044085943"}}

powerpoint45 avatar Jan 25 '24 05:01 powerpoint45