Skip to content
Snippets Groups Projects
Verified Commit c8fcd854 authored by Dave Long's avatar Dave Long
Browse files

Issue #3246454 by anish.a, kobe wright, AmaraSAU: Add weekly granularity to views date sort

parent 1ad501aa
No related branches found
No related tags found
6 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!579Issue #2230909: Simple decimals fail to pass validation,!213Issue #2906496: Give Media a menu item under Content
...@@ -39,6 +39,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -39,6 +39,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'minute' => $this->t('Minute'), 'minute' => $this->t('Minute'),
'hour' => $this->t('Hour'), 'hour' => $this->t('Hour'),
'day' => $this->t('Day'), 'day' => $this->t('Day'),
'week' => $this->t('Week'),
'month' => $this->t('Month'), 'month' => $this->t('Month'),
'year' => $this->t('Year'), 'year' => $this->t('Year'),
], ],
...@@ -70,6 +71,10 @@ public function query() { ...@@ -70,6 +71,10 @@ public function query() {
$formula = $this->getDateFormat('Ymd'); $formula = $this->getDateFormat('Ymd');
break; break;
case 'week':
$formula = $this->getDateFormat('W');
break;
case 'month': case 'month':
$formula = $this->getDateFormat('Ym'); $formula = $this->getDateFormat('Ym');
break; break;
... ...
......
...@@ -65,6 +65,16 @@ protected function expectedResultSet($granularity, $reverse = TRUE): array { ...@@ -65,6 +65,16 @@ protected function expectedResultSet($granularity, $reverse = TRUE): array {
]; ];
break; break;
case 'week':
$expected = [
['name' => 'John'],
['name' => 'George'],
['name' => 'Ringo'],
['name' => 'Paul'],
['name' => 'Meredith'],
];
break;
case 'month': case 'month':
$expected = [ $expected = [
['name' => 'John'], ['name' => 'John'],
...@@ -128,6 +138,16 @@ protected function expectedResultSet($granularity, $reverse = TRUE): array { ...@@ -128,6 +138,16 @@ protected function expectedResultSet($granularity, $reverse = TRUE): array {
]; ];
break; break;
case 'week':
$expected = [
['name' => 'John'],
['name' => 'George'],
['name' => 'Ringo'],
['name' => 'Paul'],
['name' => 'Meredith'],
];
break;
case 'month': case 'month':
$expected = [ $expected = [
['name' => 'John'], ['name' => 'John'],
...@@ -157,7 +177,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE): array { ...@@ -157,7 +177,7 @@ protected function expectedResultSet($granularity, $reverse = TRUE): array {
* Tests numeric ordering of the result set. * Tests numeric ordering of the result set.
*/ */
public function testDateOrdering(): void { public function testDateOrdering(): void {
foreach (['second', 'minute', 'hour', 'day', 'month', 'year'] as $granularity) { foreach (['second', 'minute', 'hour', 'day', 'week', 'month', 'year'] as $granularity) {
foreach ([FALSE, TRUE] as $reverse) { foreach ([FALSE, TRUE] as $reverse) {
$view = Views::getView('test_view'); $view = Views::getView('test_view');
$view->setDisplay(); $view->setDisplay();
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment