System`DateListPlotDump`DateTicks
If we could identify how the automatic GridLines
are determined it would be straightforward to add the custom grid lines to the automatic ones. It seems that we can replicate the automatically generated major date ticks and hence associated grid lines using the function System`DateListPlotDump`DateTicks
in version 11 (and Graphics`DateListPlotDump`DateTicks
in version 9).
This function takes two arguments with a third optional argument:
System`DateListPlotDump`DateTicks[arg1: {mindate, maxdate}, ndivisons, labelformat]
and returns a list of (no more than ndivisions) "nice" date divisions in the range from mindate to maxdate with each tick labeled based on labelformat.
For example,
System`DateListPlotDump`DateTicks[{{2010, 1}, {2011, 3}}, 5]
{{3.47129*10^9, "Jan"}, {3.47907*10^9, "Apr"}, {3.48693*10^9,
"Jul"}, {3.49488*10^9, "Oct"}, {3.50283*10^9,
"Jan"}, {3.5106*10^9, "Apr"}}
The optional third argument allows formatting of date labels:
System`DateListPlotDump`DateTicks[{{2000}, {2018}}, 5, {"Year", "/", "Month"}]
{{3.15567*10^9, "2000/01"}, {3.31353*10^9, "2005/01"}, {3.47129*10^9,
"2010/01"}, {3.62906*10^9, "2015/01"}, {3.78683*10^9, "2020/01"}}
The first column of the output gives the automatic grid lines on the date axis. We can append to this list additional grid lines as desired. We can replicate the major ticks on the date axis using the function
System`DateListPlotDump`DateTicks[{##}, 5, "Year"]&
in the option setting for FrameTicks
or Ticks
.
Examples:
DateListPlot[RandomReal[1, 52], {2000}, Joined -> True,
GridLines -> {(Join[System`DateListPlotDump`DateTicks[{#, #2}, 5, "Year"][[All, 1]],
{{AbsoluteTime["5 Nov 2007"], Directive[Red, Thick]},
{AbsoluteTime["5 Mar 2022"], Directive[Blue, Thickness[.007], DotDashed]}}] &), None}]

DateListPlot[RandomReal[1, 60], {2000, 1}, Joined -> True,
GridLines -> {(Join[System`DateListPlotDump`DateTicks[{#, #2}, 5, "Year"][[All, 1]],
{{AbsoluteTime["5 Nov 2001"], Directive[Red, Thick]},
{AbsoluteTime["5 Mar 2003"], Directive[Blue, Thickness[.007], DotDashed]}}] &), None}]

DateListPlot[MeanFilter[RandomReal[1, 500], 50], {2001, 5, 1},
Joined -> True, GridLinesStyle -> Green,
GridLines -> {(Join[System`DateListPlotDump`DateTicks[{#, #2}, 5, "Month"][[All, 1]],
{{AbsoluteTime["5 Nov 2001"], Directive[Red, Thick]},
{AbsoluteTime["5 Mar 2002"], Directive[Blue, Thickness[.007], DotDashed]}}] &), None}]

Post-process
Alternatively, extract the grid lines from DateListPlot
output with automatic GridLines
and use the modified list of grid lines in Show
.
dlp = DateListPlot[RandomReal[1, 60], {2000, 1}, Joined -> True,
GridLines -> {Automatic, None}];
newlines = {{AbsoluteTime["5 Nov 2001"], Directive[Red, Thick]},
{AbsoluteTime["5 Mar 2003"], Directive[Blue, Thickness[.007], DotDashed]}};
Show[dlp, GridLines -> {Join[First[GridLines /. dlp[[2]]], newlines],
Last[GridLines /. dlp[[2]]]}]

Epilog
and manually add markers for "special" dates (that is, explicitly construct a verticalLine[]
). $\endgroup$