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('2023-09-13');
dump($now->year === 2023); // true
dump($now->year === '2023'); // false, 2023 is string
dump($now->month === 9);
dump($now->day === 13);

@dg dg force-pushed the master branch 8 times, most recently from 3fbd549 to 54a435c Compare September 20, 2023 13:02
@dg dg force-pushed the master branch 2 times, most recently from 38cc5db to 0a8a17e Compare October 17, 2023 08:26
@dg dg force-pushed the master branch 5 times, most recently from 4b7b01e to 494d200 Compare November 1, 2023 20:33
@dg dg force-pushed the master branch 5 times, most recently from b843c77 to 77e9645 Compare November 26, 2023 23:02
@dg dg force-pushed the master branch 4 times, most recently from 7470bcc to cd19046 Compare November 30, 2023 12:16
@dg dg force-pushed the master branch 12 times, most recently from 6733224 to 5de10a1 Compare June 18, 2024 21:22
@dg dg force-pushed the master branch 16 times, most recently from a846fab to 736c567 Compare August 7, 2024 16:18
@dg dg force-pushed the master branch 2 times, most recently from cd9170e to 2b48b24 Compare December 12, 2024 10:02
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