code: def test_groupby_uses_calc_time(pd_es):
      def projected_amount_left(amount, timestamp, time=None):
          # cumulative sum of amount, with timedelta *  constant subtracted
          delta = time - timestamp
          delta_seconds = delta / np.timedelta64(1, "s")
          return amount.cumsum() - (delta_seconds)
  
      class ProjectedAmountRemaining(TransformPrimitive):
          name = "projected_amount_remaining"
          uses_calc_time = True
          input_types = [
              ColumnSchema(semantic_tags={"numeric"}),
              ColumnSchema(
                  logical_type=Datetime, semantic_tags={"time_index"}
              ),
          ]
          return_type = ColumnSchema(semantic_tags={"numeric"})
          uses_full_dataframe = True
  
          def get_function(self):
              return projected_amount_left
  
      time_since_product = GroupByTransformFeature(
          [
              IdentityFeature(pd_es["log"].ww["value"]),
              IdentityFeature(pd_es["log"].ww["datetime"]),
          ],
          groupby=IdentityFeature(pd_es["log"].ww["product_id"]),
          primitive=ProjectedAmountRemaining,
      )
      df = calculate_feature_matrix(
          entityset=pd_es,
          features=[time_since_product],
          cutoff_time=pd.Timestamp("2011-04-10 11:10:30"),
      )
      answers = [
          -88830,
          -88819,
          -88803,
          -88797,
          -88771,
          -88770,
          -88760,
          -88749,
          -88740,
          -88227,
          -1830,
          -1809,
          -1750,
          -1740,
          -1723,
          np.nan,
          np.nan,
      ]
  
      for x, y in zip(df[time_since_product.get_name()], answers):
          assert (pd.isnull(x) and pd.isnull(y)) or x == y
  
imports: import numpy
  import pandas
  from woodwork.column_schema import ColumnSchema
  from woodwork.logical_types import Datetime
  from featuretools import Feature, GroupByTransformFeature, IdentityFeature, calculate_feature_matrix, feature_base
  from featuretools.computational_backends.feature_set import FeatureSet
  from featuretools.computational_backends.feature_set_calculator import FeatureSetCalculator
  from featuretools.primitives import CumCount, CumMax, CumMean, CumMin, CumSum, Last
  from featuretools.primitives.base import TransformPrimitive
  from featuretools.synthesis import dfs
  from featuretools.tests.testing_utils import feature_with_name
label_desc: Use image node_id 11 for calling a global function with example usage: test_groupby_uses_calc_time(pd_es) and returns: unknown, projected_amount_left