Skip to content

Commit

Permalink
Fix grammar and block in 'Time' extension
Browse files Browse the repository at this point in the history
Block, Extract () from () was broken and was returning NaN
  • Loading branch information
ziqiangao committed Aug 19, 2023
1 parent 9f7a2ef commit 1d6f155
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions extensions/-SIPC-/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
{
opcode: 'Timestamp',
blockType: Scratch.BlockType.REPORTER,
text: 'The current timestamp',
text: 'Current timestamp',
arguments: {}
},
{
opcode: 'timezone',
blockType: Scratch.BlockType.REPORTER,
text: 'The current time zone',
text: 'Current time zone',
arguments: {}
},
{
opcode: 'Timedata',
blockType: Scratch.BlockType.REPORTER,
text: 'Extract [Timedata] from [timestamp]',
text: 'Get [Timedata] from [timestamp]',
arguments: {
timestamp: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -44,7 +44,7 @@
{
opcode: 'TimestampToTime',
blockType: Scratch.BlockType.REPORTER,
text: 'Converts [timestamp] to a datetime',
text: 'Convert [timestamp] to datetime',
arguments: {
timestamp: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -55,10 +55,10 @@
{
opcode: 'TimeToTimestamp',
blockType: Scratch.BlockType.REPORTER,
text: 'Converts [time] to a timestamp',
text: 'Convert [time] to timestamp',
arguments: {
time: {
type: Scratch.ArgumentType.NUMBER,
type: Scratch.ArgumentType.STRING,
defaultValue: '2006-04-16 06:59:40'
}
}
Expand All @@ -80,7 +80,7 @@
}
Timedata(args) {
args.timestamp = args.timestamp ? args.timestamp : null;
let date1 = new Date(args.timestamp);
let date1 = new Date(Scratch.Cast.toNumber(args.timestamp));
switch (args.Timedata) {
case 'year':
return date1.getFullYear();
Expand Down

0 comments on commit 1d6f155

Please sign in to comment.