2016-01-19 21:11:20 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import moment from 'moment-timezone';
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-10 14:52:09 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// day count between two epochs (inclusive)
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-19 21:11:20 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function dayCount([head, tail], timezone = 'UTC') {
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-10 14:52:09 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return Math.ceil(
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-09 09:10:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    moment(moment(head).tz(timezone).endOf('day')).diff(
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-19 21:11:20 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      moment(tail).tz(timezone).startOf('day'),
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-03 05:39:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      'days',
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-10 14:52:09 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      true)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    );
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |