Skip to content

Commit

Permalink
Add a comment about apple dates
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed May 28, 2019
1 parent 0210f6d commit ba93943
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Expand Up @@ -4,14 +4,15 @@ import path from "path"
import Knex from "knex"
import yargs from "yargs"

// apple have made their own epoch, the first of jan 2001
let applepoch = new Date("2001-01-01").getTime()

// they save their dates in microseconds since that epoch, so we add their
// epoch to the date and divide it by a million to make it like a unix date,
// which is the number of seconds since 1970-01-01
let convertAppleDateToIsoDate = date =>
new Date(applepoch + date / 1000000).toISOString()

// let convertIsoDateToAppleDate = date =>
// new Date(date - applepoch).getTime() * 1000000

// The file is always in the same place, and while it would be good to be able
// to take another database other than the live one (one you’ve backed up, or
let databasePath = path.resolve(
Expand Down

0 comments on commit ba93943

Please sign in to comment.