@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"}
@@ -9,9 +9,11 @@ export const isTodayParameterDefault = (definition) => definition.type === 'date
9
9
  definition.default === TODAY_PARAMETER_DEFAULT;
10
10
  /**
11
11
  * The definition's default value with the `today` sentinel resolved to the current date
12
- * (`YYYY-MM-DD`, local time of the caller). Any other default is returned as-is.
12
+ * (`YYYY-MM-DD`). The date is taken in `timezone` when given (an IANA zone such as the
13
+ * project's query timezone), otherwise in the caller's local time. Any other default is
14
+ * returned as-is.
13
15
  */
14
- export const resolveParameterDefault = (definition, now = new Date()) => isTodayParameterDefault(definition)
15
- ? formatDate(now, TimeFrames.DAY)
16
+ export const resolveParameterDefault = (definition, now = new Date(), timezone) => isTodayParameterDefault(definition)
17
+ ? formatDate(now, TimeFrames.DAY, false, timezone)
16
18
  : definition.default;
17
19
  //# sourceMappingURL=parameterDefaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parameterDefaults.js","sourceRoot":"","sources":["../../../src/parameters/parameterDefaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,UAAqC,EAC9B,EAAE,CACT,UAAU,CAAC,IAAI,KAAK,MAAM;IAC1B,UAAU,CAAC,OAAO,KAAK,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,UAAqC,EACrC,GAAG,GAAS,IAAI,IAAI,EAAE,EACI,EAAE,CAC5B,uBAAuB,CAAC,UAAU,CAAC;IAC/B,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC;IACjC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"parameterDefaults.js","sourceRoot":"","sources":["../../../src/parameters/parameterDefaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,UAAqC,EAC9B,EAAE,CACT,UAAU,CAAC,IAAI,KAAK,MAAM;IAC1B,UAAU,CAAC,OAAO,KAAK,uBAAuB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,UAAqC,EACrC,GAAG,GAAS,IAAI,IAAI,EAAE,EACtB,QAAiB,EACS,EAAE,CAC5B,uBAAuB,CAAC,UAAU,CAAC;IAC/B,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC;IAClD,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "2.253.1",
3
+ "version": "2.254.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",