moment-timezone DST bug

moment 2.11.1 moment-timezone 0.3.0

by vrluckyin India

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment-with-locales.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.3.0/moment-timezone-with-data.js"></script>
<!--vrluckyin-->
<pre id="output"></pre>

JavaScript

var 
	tzIndia = "Asia/Calcutta",
  tzUSA = "America/New_York",
	TZ = tzUSA,
	HOURS_IN_7_DAYS = 168,
  MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000,
	FORMAT = 'YYYY-MM-DD hh:mm:ss',
  dstStartDate = moment.tz('2016-03-13 10:30:15', FORMAT, TZ),
  dstEndDate = moment.tz('2016-11-05 10:30:15', FORMAT, TZ),
  regularDate = moment.tz('2016-11-06 10:30:15', FORMAT, TZ),
  $output = $('#output'),
  buffer = [];

//buffer.push('dstStartDate: ' + dstStartDate.format());
//buffer.push('<br/>dstEndDate: ' + dstEndDate.format());
//buffer.push('<br/>regularDate: ' + regularDate.format());

buffer.push('<br/>dstStartDate: ' + dstStartDate.format('YYYY-MM-DD hh:mm:ss'));
buffer.push('<br/>dstEndDate: ' + dstEndDate.format('YYYY-MM-DD hh:mm:ss'));
buffer.push('<br/>regularDate: ' + regularDate.format('YYYY-MM-DD hh:mm:ss'));
buffer.push('<br/>------------------');
buffer.push('<br/>dstStartDate: ' + dstStartDate.clone().tz(tzIndia).format('YYYY-MM-DD hh:mm:ss'));
buffer.push('<br/>dstEndDate: ' + dstEndDate.clone().tz(tzIndia).format('YYYY-MM-DD hh:mm:ss'));
buffer.push('<br/>regularDate: ' + regularDate.clone().tz(tzIndia).format('YYYY-MM-DD hh:mm:ss'));
buffer.push('<br/>------------------');
// this evaluates to 'true', but shouldn't according to 
// https://github.com/moment/moment-timezone/blob/44ce91b03aa528ceb3832d13dbcee041f09c577a/tests/zones/pacific/fiji.js#L78-L79 
buffer.push('<br/>dstStartDate.isDST: ' + dstStartDate.isDST());
buffer.push('<br/>dstEndDate.isDST: ' + dstEndDate.isDST());
buffer.push('<br/>regularDate.isDST: ' + regularDate.isDST());

$output.append(buffer);