Closed CosmicWebServices closed 7 years ago
@CosmicWebServices Thanks. We'd be happy to take a PR that implements the block, or we'll get around to it eventually.
Please check out the scratch-flash implementation: https://github.com/LLK/scratch-flash/blob/master/src/primitives/SensingPrims.as#L306
If possible, we should have the same behavior for timezones.
Regarding decimal precision: seems fine to me to have extra precision, but I haven't thought about it carefully.
OK thanks maybe when I figure out how to do it I will
Sorry for the late reply I will work o a pr soon
seems fine to me to have extra precision
The more precise the days-since-2000 block, the better. It's already crazy (and for good reason - it's a super handy block), going farther isn't going overboard!
IMO.
By the way.. I haven't checked, but does scratch-blocks limit the rendered digits of a reporter block's result bubble?
So I should leave the extra digets?
@liam4 If I remember right, as far as scratch-blocks is concerned, the bubble isn't limited and can display arbitrary HTML. @CosmicWebServices Yes, that seems fine to me.
I feel taken technically :)
I suppose that if it does (or would) do anything, that's in scratch-vm? (i.e. snipping digits from number bubble returns)
@CosmicWebServices You must rewrite https://github.com/LLK/scratch-vm/blob/develop/src/blocks/scratch3_sensing.js#L26 adding comma and on next line, add
'sensing_dayssince2000': this.daysSince2000
Next add on end of file, before module.exports
something like:
Scratch3SensingBlocks.prototype.daysSince2000 = function() {
var start = new Date(2000, 1-1, 1);
var today = new Date();
return (today.valueOf() - start.valueOf()) / 1000 / 86400;
}
Thanks @dekrain when I am done school I will do that.
nvm I will do it now
The pr is at #272
@liam4 or anyone else do you think the extra few decimal places with hurt cross-compatibility?
Nah. I don't know why anybody would need to e.g. check the length of the return value of days since 2000..
Actually some people used that in my pen challenge also the one line challenge but I think it is fine still.
This is the discussion talking about #272