diff --git a/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java b/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java
index dd599bd..f0fa2d5 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java
@@ -181,8 +181,11 @@ public class VersionedCatalog extends ValidatingConfig<VersionedCatalog> impleme
}
}
+
+ final boolean initialVersion = (i == 0);
final DateTime catalogEffectiveDate = CatalogDateHelper.toUTCDateTime(c.getEffectiveDate());
- if (!subscriptionStartDate.isBefore(catalogEffectiveDate)) { // Its a new subscription this plan always applies
+ if (initialVersion || // Prevent issue with time granularity -- see #760
+ !subscriptionStartDate.isBefore(catalogEffectiveDate)) { // It's a new subscription this plan always applies
return new CatalogPlanEntry(c, plan);
} else { //Its an existing subscription
if (plan.getEffectiveDateForExistingSubscriptions() != null) { //if it is null any change to this does not apply to existing subscriptions
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java b/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java
index 3dcb60f..b70e54f 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java
@@ -48,15 +48,9 @@ public class TestVersionedCatalog extends CatalogTestSuiteNoDB {
final DateTime dt214 = new DateTime("2011-02-14T00:01:00+00:00");
final DateTime dt3 = new DateTime("2011-03-03T00:01:00+00:00");
- // New subscription
- try {
- vc.findPlan("pistol-monthly", dt0, dt0);
- Assert.fail("Exception should have been thrown there are no plans for this date");
- } catch (CatalogApiException e) {
- // Expected behaviour
- log.error("Expected exception", e);
+ // We find it although the date provided is too early because we default to first catalog version
+ final Plan newSubPlan0 = vc.findPlan("pistol-monthly", dt0, dt0);
- }
final Plan newSubPlan1 = vc.findPlan("pistol-monthly", dt1, dt1);
final Plan newSubPlan2 = vc.findPlan("pistol-monthly", dt2, dt2);
final Plan newSubPlan214 = vc.findPlan("pistol-monthly", dt214, dt214);