Skip to content

Instantly share code, notes, and snippets.

@maximgatilin
Created March 29, 2018 07:41
Show Gist options
  • Save maximgatilin/0faa8a0bfaad5924263f27e9fdaf1f3d to your computer and use it in GitHub Desktop.
Save maximgatilin/0faa8a0bfaad5924263f27e9fdaf1f3d to your computer and use it in GitHub Desktop.
rethinkTimezones
r
.db('demo')
.table('trends')
.hasFields('Fedora 18')
.merge(ticket => {
const date = r.ISO8601(ticket('sl_created_at')).inTimezone('+05:00');
return {
...ticket,
date: r.time(date.year(), date.month(), date.day(), 'Z')
}
})
.group(ticket => ticket('date').toISO8601())
.count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment