Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Today's actual date.js #75

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Today's actual date.js #75

wants to merge 1 commit into from

Conversation

aiotv1
Copy link

@aiotv1 aiotv1 commented Dec 5, 2023

class DateTimeExtension {
getInfo() {
return {
id: 'datetimeexample',
name: 'Date and Time',
blocks: [
{
opcode: 'getCurrentDateTime',
blockType: Scratch.BlockType.REPORTER,
text: 'current date and time'
}
]
};
}

getCurrentDateTime() {
const daysOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const monthsOfYear = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

const now = new Date();
const dayOfWeek = daysOfWeek[now.getDay()];
const month = monthsOfYear[now.getMonth()];
const dayOfMonth = now.getDate();
const year = now.getFullYear();

const formattedDateTime = `${dayOfWeek}, ${month} ${dayOfMonth}, ${year}`;

return formattedDateTime;

}
}

Scratch.extensions.register(new DateTimeExtension());

Copy link

vercel bot commented Dec 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
penguinmod-extensions-gallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 5:38am

@TheShovel
Copy link
Collaborator

Please use 1 pull request. I closed the other ones.

@JeremyGamer13 JeremyGamer13 marked this pull request as draft March 10, 2024 07:35
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.

2 participants