Comments

fengtan’s picture

I believe that generated nodes' post date is already randomly distributed between "now" and the selected period you pick when you create content (see attached screenshot).

I had a quick test and noticed that post dates were indeed randomly created (edit generated nodes and check the "Authoring information" fields)

Did you mean something else ?

barraponto’s picture

Title: provide option to random generate node's post date » Provide drush option to randomize post date within a time range
Version: 7.x-1.2 » 7.x-1.x-dev

Indeed, dates are randomized in the form (the web user interface) but there's no option in the Drush command (the command line interface). Let's fix that! With this patch you can use date strings (it will use strtotime behind the curtains):

drush generate-content 420 0 --since='last year'

barraponto’s picture

Status: Active » Needs review
FileSize
1.61 KB
PASSED: [[SimpleTest]]: [MySQL] 36 pass(es). View
moshe weitzman’s picture

Status: Needs review » Needs work

Please add one or two examples on the command definition

barraponto’s picture

Status: Needs work » Needs review
FileSize
1.62 KB
PASSED: [[SimpleTest]]: [MySQL] 36 pass(es). View

Patch submitted by the Drush iq-submit command.

rj’s picture

This worked for me, would love to see it committed. Thanks.

moshe weitzman’s picture

Issue summary: View changes
Status: Needs review » Needs work

Still needs Examples in Drush help and needs D8 port.

humansky’s picture

Status: Needs work » Needs review
Issue tags: +Needs D8 port
FileSize
2.53 KB

Slightly different approach to the same problem, with added test conditions to verify the date is within valid range. Let me know what you guys think. If you like it, I will create a D8 version.