-
Notifications
You must be signed in to change notification settings - Fork 11
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
removed years on copyright #4
base: master
Are you sure you want to change the base?
Conversation
If we use a little bit of JavaScript, we can make the year dynamic. const date = new Date()
const year = date.getUTCFullYear() // this gives you the current year
const text = `Copyright © 2004 - ${year}` |
Oh that'd be cool |
Couldn't it be simplified to const date = new Date()
const text = `Copyright © 2004 - ${date.getUTCFullYear()}` I don't know much Javascript, so please correct me if I'm wrong |
That would depend on what we mean by "simplified." For instance, we could write our solution like this const text = `Copyright © 2004 - ${(new Date()).getUTCFullYear()}` This fits into one line, but is it simplified? 🤷🏽 Perhaps a better way to think of writing code is its ease of readability for humans. Consider the next example, const date = new Date()
const currentYear = date.getUTCFullYear()
const text = `Copyright © 2004 - ${currentYear}` While there is a lot more code to read, we might say that it's actually easier to read. This is a matter of style, since both code examples work perfectly. Though this is a trivial example, you can imagine a complex codebase might contain thousands of lines of code. In such a scenario, it makes a big difference when code is written in a clear and concise manner. Hope that helps! |
Hmm. You seem like a smart person, I think I'll add your suggestion |
Thanks 👍 for polling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be best
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
the copyright will still be valid, and you won't need to keep on updating the year