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

DateTimeFormat: support quick access properties #302

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

h4kuna
Copy link
Contributor

@h4kuna h4kuna commented Sep 13, 2023

  • new feature? yes
  • BC break? no
  • doc PR: nette/docs#??? if you agree with theses changes I will write.

I add trait DateTimeFormat what extends class DateTime, with quick access to frequent date and time values with right type.

I used SmartObject and added read-only properties for DateTime.

Example

use Nette\Utils\DateTime;

$now = new DateTime();
dump($now->year === 2023); // true
dump($now->year === '2023'); // false, 2023 is string
dump($now->month === 5);
dump($now->day === 13);

@dg dg force-pushed the master branch 3 times, most recently from 7ae8df7 to 0d1508c Compare December 5, 2023 14:51
@dg dg force-pushed the master branch 3 times, most recently from 5b5c893 to 81e3e6d Compare January 17, 2024 16:51
@h4kuna
Copy link
Contributor Author

h4kuna commented Mar 30, 2024

If you don't like it, let's close it.

@dg dg force-pushed the master branch 2 times, most recently from b080db7 to d668e02 Compare May 3, 2024 11:20
@dg dg force-pushed the master branch 4 times, most recently from 1e73622 to d6a9961 Compare May 16, 2024 20:06
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.

None yet

2 participants