tbDate:fix bug now comments 2
This commit is contained in:
		
							parent
							
								
									3eed08e5c8
								
							
						
					
					
						commit
						83039ccedf
					
				@ -21,6 +21,8 @@ import com.google.common.util.concurrent.ListenableFuture;
 | 
			
		||||
import com.google.common.util.concurrent.ListeningExecutorService;
 | 
			
		||||
import com.google.common.util.concurrent.MoreExecutors;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.assertj.core.api.Assertions;
 | 
			
		||||
import org.assertj.core.data.Offset;
 | 
			
		||||
import org.junit.Assert;
 | 
			
		||||
import org.junit.jupiter.api.AfterEach;
 | 
			
		||||
import org.junit.jupiter.api.Test;
 | 
			
		||||
@ -28,6 +30,7 @@ import org.mvel2.ConversionException;
 | 
			
		||||
import org.thingsboard.common.util.JacksonUtil;
 | 
			
		||||
 | 
			
		||||
import java.time.DateTimeException;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.time.ZoneId;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@ -763,6 +766,11 @@ class TbDateTest {
 | 
			
		||||
        Assert.assertEquals("22:15:30 Eastern Standard Time", d1.toTimeString("UTC", "America/New_York"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testNow() {
 | 
			
		||||
        Assertions.assertThat(TbDate.now()).isCloseTo(Instant.now().toEpochMilli(), Offset.offset(1000L));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void testResultChangeDateTime(TbDate d) {
 | 
			
		||||
        int localOffset = ZoneId.systemDefault().getRules().getOffset(d.getInstant()).getTotalSeconds();
 | 
			
		||||
        TbDateTestEntity tbDateTestEntity = new TbDateTestEntity(d.getFullYear(), d.getMonth(), d.getDate(), (d.getHours() - (localOffset/60/60)));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user