@@ -180,6 +180,10 @@ export declare abstract class Expression
180180| [sum ()](./ firestore_lite_pipelines. expression. md#expressionsum) | | <b><i>(Public Preview)</ i > </b > Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs . |
181181| [timestampAdd (unit , amount )](./ firestore_lite_pipelines. expression. md#expressiontimestampadd) | | <b><i>(Public Preview)</ i > </b > Creates an expression that adds a specified amount of time to this timestamp expression . |
182182| [timestampAdd (unit , amount )](./ firestore_lite_pipelines. expression. md#expressiontimestampadd) | | <b><i>(Public Preview)</ i > </b > Creates an expression that adds a specified amount of time to this timestamp expression . |
183+ | [timestampDiff (start , unit )](./ firestore_lite_pipelines. expression. md#expressiontimestampdiff) | | <b><i>(Public Preview)</ i > </b > Creates an expression that calculates the difference between this timestamp and another timestamp . |
184+ | [timestampDiff (start , unit )](./ firestore_lite_pipelines. expression. md#expressiontimestampdiff) | | <b><i>(Public Preview)</ i > </b > Creates an expression that calculates the difference between this timestamp and another timestamp . |
185+ | [timestampExtract (part , timezone )](./ firestore_lite_pipelines. expression. md#expressiontimestampextract) | | <b><i>(Public Preview)</ i > </b > Creates an expression that extracts a specified part from this timestamp expression . |
186+ | [timestampExtract (part , timezone )](./ firestore_lite_pipelines. expression. md#expressiontimestampextract) | | <b><i>(Public Preview)</ i > </b > Creates an expression that extracts a specified part from this timestamp expression . |
183187| [timestampSubtract (unit , amount )](./ firestore_lite_pipelines. expression. md#expressiontimestampsubtract) | | <b><i>(Public Preview)</ i > </b > Creates an expression that subtracts a specified amount of time from this timestamp expression . |
184188| [timestampSubtract (unit , amount )](./ firestore_lite_pipelines. expression. md#expressiontimestampsubtract) | | <b><i>(Public Preview)</ i > </b > Creates an expression that subtracts a specified amount of time from this timestamp expression . |
185189| [timestampToUnixMicros ()](./ firestore_lite_pipelines. expression. md#expressiontimestamptounixmicros) | | <b><i>(Public Preview)</ i > </b > Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970 - 01 - 01 00 :00 :00 UTC ). |
@@ -4818,6 +4822,146 @@ field("timestamp").timestampAdd("day", 1);
48184822
48194823` ` `
48204824
4825+ ## Expression .timestampDiff ()
4826+
4827+ > This API is provided as a preview for developers and may change based on feedback that we receive . Do not use this API in a production environment .
4828+ >
4829+
4830+ Creates an expression that calculates the difference between this timestamp and another timestamp .
4831+
4832+ <b >Signature : </b >
4833+
4834+ ` ` ` typescript
4835+ timestampDiff(start: Expression, unit: Expression): FunctionExpression;
4836+ ` ` `
4837+
4838+ #### Parameters
4839+
4840+ | Parameter | Type | Description |
4841+ | --- | --- | --- |
4842+ | start | [Expression ](./firestore_lite_pipelines .expression .md #expression_class ) | The expression evaluating to the starting timestamp . |
4843+ | unit | [Expression ](./firestore_lite_pipelines .expression .md #expression_class ) | The expression evaluates to a unit of time , must be one of ' microsecond' , ' millisecond' , ' second' , ' minute' , ' hour' , ' day' . |
4844+
4845+ <b >Returns : </b >
4846+
4847+ [FunctionExpression ](./firestore_lite_pipelines .functionexpression .md #functionexpression_class )
4848+
4849+ A new [Expression ](./firestore_pipelines .expression .md #expression_class ) representing the difference as an integer .
4850+
4851+ ### Example
4852+
4853+
4854+ ` ` ` typescript
4855+ // Calculate the difference determined by fields 'startTime' and 'unit'.
4856+ field("endTime").timestampDiff(field("startTime"), field("unit"));
4857+
4858+ ` ` `
4859+
4860+ ## Expression .timestampDiff ()
4861+
4862+ > This API is provided as a preview for developers and may change based on feedback that we receive . Do not use this API in a production environment .
4863+ >
4864+
4865+ Creates an expression that calculates the difference between this timestamp and another timestamp .
4866+
4867+ <b >Signature : </b >
4868+
4869+ ` ` ` typescript
4870+ timestampDiff(start: string | Expression, unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day'): FunctionExpression;
4871+ ` ` `
4872+
4873+ #### Parameters
4874+
4875+ | Parameter | Type | Description |
4876+ | --- | --- | --- |
4877+ | start | string \| [Expression ](./firestore_lite_pipelines .expression .md #expression_class ) | The field name of the starting timestamp . |
4878+ | unit | ' microsecond' \| ' millisecond' \| ' second' \| ' minute' \| ' hour' \| ' day' | The unit of time for the difference (e .g ., " day" , " hour" ). |
4879+
4880+ <b >Returns : </b >
4881+
4882+ [FunctionExpression ](./firestore_lite_pipelines .functionexpression .md #functionexpression_class )
4883+
4884+ A new [Expression ](./firestore_pipelines .expression .md #expression_class ) representing the difference as an integer .
4885+
4886+ ### Example
4887+
4888+
4889+ ` ` ` typescript
4890+ // Calculate the difference in days between 'endTime' and 'startTime' fields.
4891+ field("endTime").timestampDiff("startTime", "day");
4892+
4893+ ` ` `
4894+
4895+ ## Expression .timestampExtract ()
4896+
4897+ > This API is provided as a preview for developers and may change based on feedback that we receive . Do not use this API in a production environment .
4898+ >
4899+
4900+ Creates an expression that extracts a specified part from this timestamp expression .
4901+
4902+ <b >Signature : </b >
4903+
4904+ ` ` ` typescript
4905+ timestampExtract(part: TimePart, timezone?: string | Expression): FunctionExpression;
4906+ ` ` `
4907+
4908+ #### Parameters
4909+
4910+ | Parameter | Type | Description |
4911+ | --- | --- | --- |
4912+ | part | [TimePart ](./firestore_lite_pipelines .md #timepart ) | The part to extract from the timestamp (e .g ., " year" , " month" , " day" ). |
4913+ | timezone | string \| [Expression ](./firestore_lite_pipelines .expression .md #expression_class ) | The timezone to use for extraction . Valid values are from the TZ database (e .g ., " America/Los\_ Angeles" ) or in the format " Etc/GMT-1." |
4914+
4915+ <b >Returns : </b >
4916+
4917+ [FunctionExpression ](./firestore_lite_pipelines .functionexpression .md #functionexpression_class )
4918+
4919+ A new [Expression ](./firestore_pipelines .expression .md #expression_class ) representing the extracted part as an integer .
4920+
4921+ ### Example
4922+
4923+
4924+ ` ` ` typescript
4925+ // Extract the year from the 'createdAt' field.
4926+ field('createdAt').timestampExtract('year')
4927+
4928+ ` ` `
4929+
4930+ ## Expression .timestampExtract ()
4931+
4932+ > This API is provided as a preview for developers and may change based on feedback that we receive . Do not use this API in a production environment .
4933+ >
4934+
4935+ Creates an expression that extracts a specified part from this timestamp expression .
4936+
4937+ <b >Signature : </b >
4938+
4939+ ` ` ` typescript
4940+ timestampExtract(part: Expression, timezone?: string | Expression): FunctionExpression;
4941+ ` ` `
4942+
4943+ #### Parameters
4944+
4945+ | Parameter | Type | Description |
4946+ | --- | --- | --- |
4947+ | part | [Expression ](./firestore_lite_pipelines .expression .md #expression_class ) | The expression evaluating to the part to extract . |
4948+ | timezone | string \| [Expression ](./firestore_lite_pipelines .expression .md #expression_class ) | The timezone to use for extraction . Valid values are from the TZ database (e .g ., " America/Los\_ Angeles" ) or in the format " Etc/GMT-1." |
4949+
4950+ <b >Returns : </b >
4951+
4952+ [FunctionExpression ](./firestore_lite_pipelines .functionexpression .md #functionexpression_class )
4953+
4954+ A new [Expression ](./firestore_pipelines .expression .md #expression_class ) representing the extracted part as an integer .
4955+
4956+ ### Example
4957+
4958+
4959+ ` ` ` typescript
4960+ // Extract the part specified by the field 'extractionPart' from 'createdAt'.
4961+ field('createdAt').timestampExtract(field('extractionPart'))
4962+
4963+ ` ` `
4964+
48214965## Expression .timestampSubtract ()
48224966
48234967> This API is provided as a preview for developers and may change based on feedback that we receive . Do not use this API in a production environment .
0 commit comments