12 lines
		
	
	
		
			417 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			417 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
export const dateWithoutTimezone = (date: Date) => {
 | 
						|
    const tzoffset = date.getTimezoneOffset() * 60000; //offset in milliseconds
 | 
						|
    const withoutTimezone = new Date(date.valueOf() - tzoffset)
 | 
						|
        .toISOString()
 | 
						|
        .slice(0, -1);
 | 
						|
    return withoutTimezone;
 | 
						|
};
 | 
						|
 | 
						|
export const getDigitsCount = (num: number): number => {
 | 
						|
    if (num === 0) return 1;
 | 
						|
    return Math.floor(Math.log10(Math.abs(num))) + 1;
 | 
						|
}; |