leopard-js / leopard

Library for making Scratch-like projects with JavaScript.
https://leopardjs.com
MIT License
136 stars 26 forks source link

"Current (date/time)" block should access a built-in value #179

Open towerofnix opened 1 year ago

towerofnix commented 1 year ago

For deterministic project running (https://github.com/leopard-js/leopard/issues/171#issuecomment-1474828676), we need a way to proivde/recall a specific value for all date and time related blocks.

The "current (date/time)" block is a good way to introduce learning JavaScript programmers to simple date/time concepts. So, I don't want to introduce a new function which would throw all that out the window. Instead I think we should replace the (new Date()) "magic" syntax with the simple this.date. This better represents that a date is in fact a normal piece of data.

It takes away the information about how to construct a date, but that isn't very useful in the first place, because nothing in Leopard shows how to construct a specific date (except, technically, new Date(2000, 0, 1) in "days since 2000", but that's an extremely complicated block for educational syntax to be buried in.)

Instead, it reinforces the parts that are actually being taught - the names of date-related methods - and primes the user to recognize them when they eventually branch out and learn more about dates.