PluginProbe
FakerPress / 0.8.0
FakerPress v0.8.0
0.9.2 trunk 0.1.0 0.1.1 0.1.2 0.1.3 0.5.2 0.5.3 0.6.1 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.7.0 0.7.1 0.7.2 0.8.0 0.9.0 0.9.1
fakerpress / src / FakerPress / Dates.php

Dates.php in FakerPress 0.8.0, at src/FakerPress/Dates.php

65 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace FakerPress;
3
4 use FakerPress\ThirdParty\Cake\Chronos\Chronos;
5
6 Class Dates {
7
8 public static function get_intervals(){
9 return apply_filters(
10 'fakerpress/date.get_intervals',
11 [
12 [
13 'id' => 'today',
14 'text' => esc_attr__( 'Today', 'fakerpress' ),
15 'min' => Chronos::today()->toDateString(),
16 'max' => Chronos::today()->toDateString(),
17 ],
18 [
19 'id' => 'yesterday',
20 'text' => esc_attr__( 'Yesterday', 'fakerpress' ),
21 'min' => Chronos::yesterday()->toDateString(),
22 'max' => Chronos::yesterday()->toDateString(),
23 ],
24 [
25 'id' => 'tomorrow',
26 'text' => esc_attr__( 'Tomorrow', 'fakerpress' ),
27 'min' => Chronos::tomorrow()->toDateString(),
28 'max' => Chronos::tomorrow()->toDateString(),
29 ],
30 [
31 'id' => 'this week',
32 'text' => esc_attr__( 'This week', 'fakerpress' ),
33 'min' => ( Chronos::today()->dayOfWeek === 1 ? Chronos::today()->toDateString() : Chronos::parse( 'last monday' )->toDateString() ),
34 'max' => ( Chronos::today()->dayOfWeek === 0 ? Chronos::today()->toDateString() : Chronos::parse( 'next sunday' )->toDateString() ),
35 ],
36 [
37 'id' => 'this month',
38 'text' => esc_attr__( 'This month', 'fakerpress' ),
39 'min' => Chronos::today()->day( 1 )->toDateString(),
40 'max' => Chronos::parse( 'last day of this month' )->toDateString(),
41 ],
42 [
43 'id' => 'this year',
44 'text' => esc_attr__( 'This year', 'fakerpress' ),
45 'min' => Chronos::today()->day( 1 )->month( 1 )->toDateString(),
46 'max' => Chronos::parse( 'last day of december' )->toDateString(),
47 ],
48 [
49 'id' => 'last 15 days',
50 'text' => esc_attr__( 'Last 15 days', 'fakerpress' ),
51 'min' => Chronos::today()->subDays( 15 )->toDateString(),
52 'max' => Chronos::today()->toDateString(),
53 ],
54 [
55 'id' => 'next 15 days',
56 'text' => esc_attr__( 'Next 15 Days', 'fakerpress' ),
57 'min' => Chronos::today()->toDateString(),
58 'max' => Chronos::today()->addDays( 15 )->toDateString(),
59 ],
60 ]
61 );
62 }
63
64 }
65