Skip to content

DateTimeFormat: support quick access properties#302

Closed
h4kuna wants to merge 4 commits intonette:masterfrom
h4kuna:fast-properties
Closed

DateTimeFormat: support quick access properties#302
h4kuna wants to merge 4 commits intonette:masterfrom
h4kuna:fast-properties

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 2 times, most recently from e673736 to 299a857 Compare January 9, 2026 09:58
@dg dg force-pushed the master branch 13 times, most recently from 167d27a to 2ddfcc6 Compare February 10, 2026 05:52
@dg dg force-pushed the master branch 14 times, most recently from 7c0abb7 to bb3ea63 Compare February 13, 2026 03:06
@h4kuna h4kuna closed this Feb 13, 2026
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