-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
I noticed the wrong time on an app I have whne comparing to another calendar
I put together this test
I think the java Calendar date math does not properly handle the Daylight savings time shift
Any Sugestions
package com.kosherjava.zmanim;
import com.kosherjava.zmanim.hebrewcalendar.JewishCalendar;
import java.util.Date;
import java.util.TimeZone;
public class TestMain {
static void printinfo(Date d) {
JewishCalendar jc = new JewishCalendar(d);
System.out.println(d);
System.out.println(jc.getMolad());
System.out.println(jc.getMoladAsDate());
System.out.println(jc.getTchilasZmanKidushLevana3Days());
System.out.println(jc.getTchilasZmanKidushLevana7Days());
System.out.println(jc.getSofZmanKidushLevanaBetweenMoldos());
System.out.println(jc.getSofZmanKidushLevana15Days());
}
public static void main(String[] args) {
Date d = new Date();
printinfo(d);
System.out.println("=====================================");
TimeZone.setDefault(TimeZone.getTimeZone("EST"));
printinfo(d);
}
}
output
Sun Nov 21 18:49:34 EST 2021 <<<<<<<<<<<<<< note date run moled was before DST
1 Kislev, 5782
Thu Nov 04 18:34:46 EDT 2021
Sun Nov 07 17:34:46 EST 2021
Thu Nov 11 17:34:46 EST 2021
Fri Nov 19 12:56:48 EST 2021 <<<<<<<<<<<<< this 12 should be 11
Fri Nov 19 18:34:46 EST 2021
Sun Nov 21 18:49:34 EST 2021
1 Kislev, 5782
Thu Nov 04 17:34:46 EST 2021
Sun Nov 07 17:34:46 EST 2021
Thu Nov 11 17:34:46 EST 2021
Fri Nov 19 11:56:48 EST 2021 <<<<<<<<<<<<<<<<<< correct but does not match
Fri Nov 19 17:34:46 EST 2021
Metadata
Metadata
Assignees
Labels
No labels