@lightdash/common 2.253.1 → 2.254.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,9 @@ export declare const TODAY_PARAMETER_DEFAULT = "today";
8
8
  export declare const isTodayParameterDefault: (definition: LightdashProjectParameter) => boolean;
9
9
  /**
10
10
  * The definition's default value with the `today` sentinel resolved to the current date
11
- * (`YYYY-MM-DD`, local time of the caller). Any other default is returned as-is.
11
+ * (`YYYY-MM-DD`). The date is taken in `timezone` when given (an IANA zone such as the
12
+ * project's query timezone), otherwise in the caller's local time. Any other default is
13
+ * returned as-is.
12
14
  */
13
- export declare const resolveParameterDefault: (definition: LightdashProjectParameter, now?: Date) => ParameterValue | undefined;
15
+ export declare const resolveParameterDefault: (definition: LightdashProjectParameter, now?: Date, timezone?: string) => ParameterValue | undefined;
14
16
  //# sourceMappingURL=parameterDefaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parameterDefaults.d.ts","sourceRoot":"","sources":["../../../src/parameters/parameterDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,eAAO,MAAM,uBAAuB,eACpB,yBAAyB,KACtC,OAE+C,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,eACpB,yBAAyB,QAChC,IAAI,KACV,cAAc,GAAG,SAGQ,CAAC"}
1
+ {"version":3,"file":"parameterDefaults.d.ts","sourceRoot":"","sources":["../../../src/parameters/parameterDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,eAAO,MAAM,uBAAuB,eACpB,yBAAyB,KACtC,OAE+C,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,eACpB,yBAAyB,QAChC,IAAI,aACE,MAAM,KAClB,cAAc,GAAG,SAGQ,CAAC"}
@@ -13,10 +13,12 @@ const isTodayParameterDefault = (definition) => definition.type === 'date' &&
13
13
  exports.isTodayParameterDefault = isTodayParameterDefault;
14
14
  /**
15
15
  * The definition's default value with the `today` sentinel resolved to the current date
16
- * (`YYYY-MM-DD`, local time of the caller). Any other default is returned as-is.
16
+ * (`YYYY-MM-DD`). The date is taken in `timezone` when given (an IANA zone such as the
17
+ * project's query timezone), otherwise in the caller's local time. Any other default is
18
+ * returned as-is.
17
19
  */
18
- const resolveParameterDefault = (definition, now = new Date()) => (0, exports.isTodayParameterDefault)(definition)
19
- ? (0, formatting_1.formatDate)(now, timeFrames_1.TimeFrames.DAY)
20
+ const resolveParameterDefault = (definition, now = new Date(), timezone) => (0, exports.isTodayParameterDefault)(definition)
21
+ ? (0, formatting_1.formatDate)(now, timeFrames_1.TimeFrames.DAY, false, timezone)
20
22
  : definition.default;
21
23
  exports.resolveParameterDefault = resolveParameterDefault;
22
24
  //# sourceMappingURL=parameterDefaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parameterDefaults.js","sourceRoot":"","sources":["../../../src/parameters/parameterDefaults.ts"],"names":[],"mappings":";;;AAEA,oDAAiD;AACjD,oDAAiD;AAEjD;;;GAGG;AACU,QAAA,uBAAuB,GAAG,OAAO,CAAC;AAExC,MAAM,uBAAuB,GAAG,CACnC,UAAqC,EAC9B,EAAE,CACT,UAAU,CAAC,IAAI,KAAK,MAAM;IAC1B,UAAU,CAAC,OAAO,KAAK,QAAA,uBAAuB,CAAC;AAJtC,QAAA,uBAAuB,GAAvB,uBAAuB,CAIe;AAEnD;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CACnC,UAAqC,E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