Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Dec 2013 at 19:53 UTC
Updated:
12 Aug 2014 at 23:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
vijaycs85Comment #2
penyaskitoComment #3
penyaskitoThe attached patch injects the date service when possible, and uses \Drupal::service('date')->formatInterval() in procedural code.
Comment #5
penyaskitoFixed one typo.
I don't have any idea about the views fields related failures, I will try to ping someone for those.
Comment #7
penyaskitoJust found that it was the very same typo in a different place.
Comment #8
vijaycs85Great work. Minor comment variable fix needed:
$date_service?
$date_service?
Comment #9
penyaskitoNice catches!
Comment #10
vijaycs85More review after applying the patch
can be changed to
Comment #11
vijaycs85updating changes for #10. Not sure whether we really to test this case (passing class and method as callback) as it is PHP thingy.
Comment #12
tim.plunkettThese indentations (and others throughout) are non-standard. Either split onto two lines, or leave s one (which is fine!)
Comment #13
penyaskitoOops, I thought that I was improving the situation instead of going backwards... Sorry.
Attended Tim feedback-
Comment #14
penyaskitoWe are supposed to use $this->container->get() inside simpletests instead of \Drupal (just lernt that in #2149195-18: Replace format_plural with \Drupal::translation()->formatPlural())
Comment #15
penyaskitoStraight reroll.
Comment #16
penyaskitoJust unlernt #14 because it is under discussion (see #2087751: [policy, no patch] Stop using $this->container in web tests).
Comment #17
penyaskito15: 2149197-formatInterval-15.patch queued for re-testing.
Comment #20
vijaycs85Re-roll...
Comment #21
penyaskitoComment #22
vijaycs85Re-rolling. Found 2 more instances of format_interval (system.install and run-test.sh file). updating them as separate patch...
Comment #23
vijaycs85Seems impact of #2130059: Issue status change not consistently saved in node revisions
Comment #24
herom commentedrepeating history (rerolled #22).
Comment #25
herom commentedand that.
Comment #26
dawehnerHow is that WSCCI? WSCCI !== Make stuff services.
Comment #27
penyaskitoRerolled after #2005716: Promote EntityType to a domain object landed.
Comment #30
penyaskitoTests failed because couldn't write config files.
Comment #31
penyaskito27: 2149197-format_interval-27-with-system_install.patch queued for re-testing.
Comment #32
penyaskitoComment #33
penyaskitoRerolled.
Comment #35
penyaskitoForgot a comma while merging.
Comment #36
penyaskito35: 2149197-format_interval-35-with-system_install.patch queued for re-testing.
Comment #38
mikey_p commentedTried to apply and re-roll the last patch without success, so here's a manual re-roll and update. Should this patch also remove the original format_interval function?
Comment #39
mikey_p commentedWhoops empty patch. Also my first version I tried to add ContainerFactoryPluginInterface to BlockBase in order to inject the date service, but that broke a number of other block plugins, what's the best way to go about resolving that?
Comment #42
mikey_p commentedMissing an assignment in a constructor.
Comment #43
mikey_p commentedAnd now with format_interval removed as well.
Comment #44
dawehnerUrgs, this is quite confusing, but I guess Date is already part of the global namespace, right?
I wonder whether we can come up with a more descriptive name for the variable? Maybe just dateFormatter in cases it makes sense ?
Comment #45
mikey_p commentedRenamed to dateFormatter and cleaned up usage around core as well.
Comment #47
mikey_p commentedTypo in that last file I had open...
Comment #48
mikey_p commentedFound another missing rename.
Comment #50
mikey_p commentedComment #51
mikey_p commentedShould we add formatInterval method on controller, plugin, form etc as was done with formatPlural over at #2149195: Replace format_plural with \Drupal::translation()->formatPlural()
Comment #52
dawehnerThank you for that hard work!
Comment #53
alexpottReading this issue makes me want to ask for the
dateto be renameddate.formatterand the class to be renamed too.Committed 5783e08 and pushed to 8.x. Thanks!
Comment #55
mikey_p commentedOpened a followup at #2309221: Drupal\Core\Datetime\Date should be renamed to DateFormatter