How do I pass dynamic year and month to the .after() and .before() functions? I've a URL /news/archive/2014/12

A route parses that as going to an archive template and captures a year and month variable. I then want to select all the entries from that month, and I can't work out how. Here's what works for just the year:

{% set entriesInPeriod = craft.entries.section('news').limit(null).after(year).before(year+1) %}


And the docs say the after and before functions need things specified in the format:

YYYY
YYYY-MM


I can't get that passed in because I don't know how Craft is interpolating the contents of the parenthasise; if I do

{% set entriesInPeriod = craft.entries.section('news').limit(null).after(year-month).before(year-month+1) %}


I'm not getting any results.

UPDATE: Answer below (use ~ to concat strings) doesn't work correctly because in reality months 'loop' after 12. What gets put in the query when starting in December evaluates to 'month after 12 and before 13', which is garbage.

Is there a way to get something like:

{% set entriesInPeriod = craft.entries.section('news').limit(null).postDate(year~'-'~month) %}


This doesn't work, but I can find no documentation on how postDate should be formatted in this use case.
In Twig, you concatenate strings with the ~ operator. So, if year and month are variables in your template, you can create a string in the required format like this

{% set yearMonth = year ~ '-' ~ month %}