Skip to content

prodatakey/reset-date-cache

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reset-date-cache

Build Status Coverage Status

Reset V8's date cache on demand.

The underlying call being made is quite expensive so it should only be used where absolutely necessary.

Install

$ npm install reset-date-cache

Test

$ npm test

Example

const reset = require('reset-date-cache')
const assert = require('assert')

var d = new Date('10/20/2015 8:50:00 AM UTC')
var orig = d.toString()

process.env.TZ = 'US/Hawaii'
reset()

var d2 = new Date('10/20/2015 8:50:00 AM UTC')
assert.equal(d2.toString(), 'Mon Oct 19 2015 22:50:00 GMT-1000 (HST)')

delete process.env.TZ

reset()

var d3 = new Date('10/20/2015 8:50:00 AM UTC')
assert.equal(d3.toString(), orig)

reset()

Author

Evan Lucas

License

MIT (See LICENSE for more info)

About

reset v8's date cache on demand

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 46.3%
  • C++ 40.9%
  • Python 12.8%