From c5fb00e8c1a37d3702ebdd78565c3968f5236676 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 17 Jul 2019 08:31:18 -0600 Subject: [PATCH 1/3] WIP Flux date package --- .../reference/flux/functions/date/_index.md | 59 +++++++++++++++++++ .../flux/language/built-ins/_index.md | 16 ----- .../flux/language/built-ins/time-constants.md | 56 ------------------ .../{built-ins => }/system-built-ins.md | 6 +- 4 files changed, 63 insertions(+), 74 deletions(-) create mode 100644 content/v2.0/reference/flux/functions/date/_index.md delete mode 100644 content/v2.0/reference/flux/language/built-ins/_index.md delete mode 100644 content/v2.0/reference/flux/language/built-ins/time-constants.md rename content/v2.0/reference/flux/language/{built-ins => }/system-built-ins.md (85%) diff --git a/content/v2.0/reference/flux/functions/date/_index.md b/content/v2.0/reference/flux/functions/date/_index.md new file mode 100644 index 000000000..adc7cb9b5 --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/_index.md @@ -0,0 +1,59 @@ +--- +title: Flux date package +list_title: Date package +description: > + The Flux math package provides basic constants and mathematical functions. + Import the `math` package. +aliases: + - /v2.0/reference/flux/language/built-ins/time-constants/ +menu: + v2_0_ref: + name: Date + parent: Flux packages and functions +weight: 202 +v2.0/tags: [date, time, functions] +--- + +The Flux date package provides date and time constants and functions. +Import the `date` package. + +```js +import "date" +``` + +## Date and time constants +That `date` package includes the following date and time constants. + +### Days of the week +Days of the week are represented as integers in the range `[0-6]`. + +```js +date.Sunday = 0 +date.Monday = 1 +date.Tuesday = 2 +date.Wednesday = 3 +date.Thursday = 4 +date.Friday = 5 +date.Saturday = 6 +``` + +### Months of the year +Months are represented as integers in the range `[1-12]`. + +```js +date.January = 1 +date.February = 2 +date.March = 3 +date.April = 4 +date.May = 5 +date.June = 6 +date.July = 7 +date.August = 8 +date.September = 9 +date.October = 10 +date.November = 11 +date.December = 12 +``` + +## Date and time functions +{{< children type="functions" show="pages" >}} diff --git a/content/v2.0/reference/flux/language/built-ins/_index.md b/content/v2.0/reference/flux/language/built-ins/_index.md deleted file mode 100644 index fb35c8b71..000000000 --- a/content/v2.0/reference/flux/language/built-ins/_index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Built-ins -description: > - Flux contains many preassigned values. - These preassigned values are defined in the source files for the various built-in packages. -menu: - v2_0_ref: - name: Built-ins - parent: Flux specification -weight: 208 ---- - -Flux contains many preassigned values. -These preassigned values are defined in the source files for the various built-in packages. - -{{< children >}} diff --git a/content/v2.0/reference/flux/language/built-ins/time-constants.md b/content/v2.0/reference/flux/language/built-ins/time-constants.md deleted file mode 100644 index 7d0dae6ac..000000000 --- a/content/v2.0/reference/flux/language/built-ins/time-constants.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: Time constants -description: > - Flux provides built-in time constants for days of the week and months of the year. -menu: - v2_0_ref: - name: Time constants - parent: Built-ins -weight: 301 ---- - -{{% note %}} -This document is a living document and may not represent the current implementation of Flux. -Any section that is not currently implemented is commented with a **[IMPL#XXX]** where -**XXX** is an issue number tracking discussion and progress towards implementation. -{{% /note %}} - -## Days of the week -Days of the week are represented as integers in the range `[0-6]`. -The following builtin values are defined: - -```js -Sunday = 0 -Monday = 1 -Tuesday = 2 -Wednesday = 3 -Thursday = 4 -Friday = 5 -Saturday = 6 -``` - -{{% note %}} -[IMPL#153](https://github.com/influxdata/flux/issues/153) Add Days of the Week constants -{{% /note %}} - -## Months of the year -Months are represented as integers in the range `[1-12]`. -The following builtin values are defined: -```js -January = 1 -February = 2 -March = 3 -April = 4 -May = 5 -June = 6 -July = 7 -August = 8 -September = 9 -October = 10 -November = 11 -December = 12 -``` - -{{% note %}} -[IMPL#154](https://github.com/influxdata/flux/issues/154) Add Months of the Year constants -{{% /note %}} diff --git a/content/v2.0/reference/flux/language/built-ins/system-built-ins.md b/content/v2.0/reference/flux/language/system-built-ins.md similarity index 85% rename from content/v2.0/reference/flux/language/built-ins/system-built-ins.md rename to content/v2.0/reference/flux/language/system-built-ins.md index 933e09fb8..de25578e2 100644 --- a/content/v2.0/reference/flux/language/built-ins/system-built-ins.md +++ b/content/v2.0/reference/flux/language/system-built-ins.md @@ -3,11 +3,13 @@ title: System built-ins description: > When a built-in value is not expressible in Flux, its value may be defined by the hosting environment. All such values must have a corresponding builtin statement to declare the existence and type of the built-in value. +aliases: + - /v2.0/reference/flux/language/built-ins/system-built-ins/ menu: v2_0_ref: name: System built-ins - parent: Built-ins -weight: 301 + parent: Flux specification +weight: 206 --- When a built-in value is not expressible in Flux, its value may be defined by the hosting environment. From 46a77d15cdf1df2846b46a893cc4014972943d26 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 17 Jul 2019 16:10:16 -0600 Subject: [PATCH 2/3] added functions for date package --- .../reference/flux/functions/date/hour.md | 31 +++++++++++++++++++ .../reference/flux/functions/date/minute.md | 31 +++++++++++++++++++ .../reference/flux/functions/date/month.md | 31 +++++++++++++++++++ .../reference/flux/functions/date/monthday.md | 31 +++++++++++++++++++ .../reference/flux/functions/date/second.md | 31 +++++++++++++++++++ .../reference/flux/functions/date/weekday.md | 31 +++++++++++++++++++ .../reference/flux/functions/date/yearday.md | 31 +++++++++++++++++++ docs-v2 | 1 - 8 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 content/v2.0/reference/flux/functions/date/hour.md create mode 100644 content/v2.0/reference/flux/functions/date/minute.md create mode 100644 content/v2.0/reference/flux/functions/date/month.md create mode 100644 content/v2.0/reference/flux/functions/date/monthday.md create mode 100644 content/v2.0/reference/flux/functions/date/second.md create mode 100644 content/v2.0/reference/flux/functions/date/weekday.md create mode 100644 content/v2.0/reference/flux/functions/date/yearday.md delete mode 160000 docs-v2 diff --git a/content/v2.0/reference/flux/functions/date/hour.md b/content/v2.0/reference/flux/functions/date/hour.md new file mode 100644 index 000000000..c2a32632f --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/hour.md @@ -0,0 +1,31 @@ +--- +title: date.hour() function +description: > + The `date.hour()` function returns the hour within the day the specified time falls in. + Results are in the range `[0-23]`. +menu: + v2_0_ref: + name: date.hour + parent: Date +weight: 301 +--- + +The `date.hour()` function returns the hour within the day a specified time falls in. +Results are in the range `[0-23]`. + +_**Function type:** Transformation_ + +```js +import "date" + +date.functionName(t: 2019-07-17T12:05:21.012Z) + +// Returns 12 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/content/v2.0/reference/flux/functions/date/minute.md b/content/v2.0/reference/flux/functions/date/minute.md new file mode 100644 index 000000000..7eac7c4e6 --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/minute.md @@ -0,0 +1,31 @@ +--- +title: date.minute() function +description: > + The `date.minute()` function returns the minute within the hour the specified time falls in. + Results are in the range in the range `[0-59]`. +menu: + v2_0_ref: + name: date.minute + parent: Date +weight: 301 +--- + +The `date.minute()` function returns the minute within the hour a specified time falls in. +Results are in the range in the range `[0-59]`. + +_**Function type:** Transformation_ + +```js +import "date" + +date.minute(t: 2019-07-17T12:05:21.012Z) + +// Returns 21 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/content/v2.0/reference/flux/functions/date/month.md b/content/v2.0/reference/flux/functions/date/month.md new file mode 100644 index 000000000..02108b673 --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/month.md @@ -0,0 +1,31 @@ +--- +title: date.month() function +description: > + The `date.month()` function returns the month of the year a specified time falls in. + Results are in the range `[1-12]` +menu: + v2_0_ref: + name: date.month + parent: Date +weight: 301 +--- + +The `date.month()` function returns the month of the year a specified time falls in. +Results are in the range `[1-12]` + +_**Function type:** Transformation_ + +```js +import "date" + +date.month(t: 2019-07-17T12:05:21.012Z) + +// Returns 7 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/content/v2.0/reference/flux/functions/date/monthday.md b/content/v2.0/reference/flux/functions/date/monthday.md new file mode 100644 index 000000000..b0312140a --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/monthday.md @@ -0,0 +1,31 @@ +--- +title: date.monthDay() function +description: > + The `date.monthDay()` function returns the day of the month for the specified time. + Results are in the range `[1-31]`. +menu: + v2_0_ref: + name: date.monthDay + parent: Date +weight: 301 +--- + +The `date.monthDay()` function returns the day of the month for the specified time. +Results are in the range `[1-31]`. + +_**Function type:** Transformation_ + +```js +import "date" + +date.monthDay(t: 2019-07-17T12:05:21.012Z) + +// Returns 17 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/content/v2.0/reference/flux/functions/date/second.md b/content/v2.0/reference/flux/functions/date/second.md new file mode 100644 index 000000000..afe5c17fb --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/second.md @@ -0,0 +1,31 @@ +--- +title: date.second() function +description: > + The `date.second()` function returns the second within the minute the specified time falls in. + Results are in the range `[0, 59]`. +menu: + v2_0_ref: + name: date.second + parent: Date +weight: 301 +--- + +The `date.second()` function returns the second within the minute the specified time falls in. +Results are in the range `[0, 59]`. + +_**Function type:** Transformation_ + +```js +import "date" + +date.second(t: 2019-07-17T12:05:21.012Z) + +// Returns 21 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/content/v2.0/reference/flux/functions/date/weekday.md b/content/v2.0/reference/flux/functions/date/weekday.md new file mode 100644 index 000000000..7532ec42e --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/weekday.md @@ -0,0 +1,31 @@ +--- +title: date.weekDay() function +description: > + The `date.weekDay()` function returns the day of the week the specified time falls in. + Results are in the range `[0, 6]`. +menu: + v2_0_ref: + name: date.weekDay + parent: Date +weight: 301 +--- + +The `date.weekDay()` function returns the day of the week the specified time falls in. +Results are in the range `[0, 6]`. + +_**Function type:** Transformation_ + +```js +import "date" + +date.weekDay(t: 2019-07-17T12:05:21.012Z) + +// Returns 3 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/content/v2.0/reference/flux/functions/date/yearday.md b/content/v2.0/reference/flux/functions/date/yearday.md new file mode 100644 index 000000000..a05cbb045 --- /dev/null +++ b/content/v2.0/reference/flux/functions/date/yearday.md @@ -0,0 +1,31 @@ +--- +title: date.yearDay() function +description: > + The `date.yearDay()` function returns the day of the year the specified time falls in. + Results are in the range `[1, 365]` for non-leap years, and `[1, 366]` in leap years. +menu: + v2_0_ref: + name: date.yearDay + parent: Date +weight: 301 +--- + +The `date.yearDay()` function returns the day of the year the specified time falls in. +Results are in the range `[1, 365]` for non-leap years, and `[1, 366]` in leap years. + +_**Function type:** Transformation_ + +```js +import "date" + +date.yearDay(t: 2019-07-17T12:05:21.012Z) + +// Returns 198 +``` + +## Parameters + +### t +The time to operate on. + +_**Data type:** Time_ diff --git a/docs-v2 b/docs-v2 deleted file mode 160000 index fb6e0a322..000000000 --- a/docs-v2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fb6e0a3224f5e84a45d7c654e8a870bcaaddaadc From ff3bdf6bb8c6400c90976128e24e3b735429c7b9 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 18 Jul 2019 06:36:55 -0600 Subject: [PATCH 3/3] updated date functions to address PR feedback --- content/v2.0/reference/flux/functions/date/hour.md | 10 +++++----- content/v2.0/reference/flux/functions/date/minute.md | 8 ++++---- content/v2.0/reference/flux/functions/date/month.md | 8 ++++---- content/v2.0/reference/flux/functions/date/monthday.md | 8 ++++---- content/v2.0/reference/flux/functions/date/second.md | 8 ++++---- content/v2.0/reference/flux/functions/date/weekday.md | 8 ++++---- content/v2.0/reference/flux/functions/date/yearday.md | 8 ++++---- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/content/v2.0/reference/flux/functions/date/hour.md b/content/v2.0/reference/flux/functions/date/hour.md index c2a32632f..619d0aa8d 100644 --- a/content/v2.0/reference/flux/functions/date/hour.md +++ b/content/v2.0/reference/flux/functions/date/hour.md @@ -1,8 +1,8 @@ --- title: date.hour() function description: > - The `date.hour()` function returns the hour within the day the specified time falls in. - Results are in the range `[0-23]`. + The `date.hour()` function returns the hour of a specified time. + Results range from `[0-23]`. menu: v2_0_ref: name: date.hour @@ -10,15 +10,15 @@ menu: weight: 301 --- -The `date.hour()` function returns the hour within the day a specified time falls in. -Results are in the range `[0-23]`. +The `date.hour()` function returns the hour of a specified time. +Results range from `[0-23]`. _**Function type:** Transformation_ ```js import "date" -date.functionName(t: 2019-07-17T12:05:21.012Z) +date.hour(t: 2019-07-17T12:05:21.012Z) // Returns 12 ``` diff --git a/content/v2.0/reference/flux/functions/date/minute.md b/content/v2.0/reference/flux/functions/date/minute.md index 7eac7c4e6..fcc940da3 100644 --- a/content/v2.0/reference/flux/functions/date/minute.md +++ b/content/v2.0/reference/flux/functions/date/minute.md @@ -1,8 +1,8 @@ --- title: date.minute() function description: > - The `date.minute()` function returns the minute within the hour the specified time falls in. - Results are in the range in the range `[0-59]`. + The `date.minute()` function returns the minute of a specified time. + Results range from `[0-59]`. menu: v2_0_ref: name: date.minute @@ -10,8 +10,8 @@ menu: weight: 301 --- -The `date.minute()` function returns the minute within the hour a specified time falls in. -Results are in the range in the range `[0-59]`. +The `date.minute()` function returns the minute of a specified time. +Results range from `[0-59]`. _**Function type:** Transformation_ diff --git a/content/v2.0/reference/flux/functions/date/month.md b/content/v2.0/reference/flux/functions/date/month.md index 02108b673..266326011 100644 --- a/content/v2.0/reference/flux/functions/date/month.md +++ b/content/v2.0/reference/flux/functions/date/month.md @@ -1,8 +1,8 @@ --- title: date.month() function description: > - The `date.month()` function returns the month of the year a specified time falls in. - Results are in the range `[1-12]` + The `date.month()` function returns the month of a specified time. + Results range from `[1-12]` menu: v2_0_ref: name: date.month @@ -10,8 +10,8 @@ menu: weight: 301 --- -The `date.month()` function returns the month of the year a specified time falls in. -Results are in the range `[1-12]` +The `date.month()` function returns the month of a specified time. +Results range from `[1-12]` _**Function type:** Transformation_ diff --git a/content/v2.0/reference/flux/functions/date/monthday.md b/content/v2.0/reference/flux/functions/date/monthday.md index b0312140a..7e95af6e7 100644 --- a/content/v2.0/reference/flux/functions/date/monthday.md +++ b/content/v2.0/reference/flux/functions/date/monthday.md @@ -1,8 +1,8 @@ --- title: date.monthDay() function description: > - The `date.monthDay()` function returns the day of the month for the specified time. - Results are in the range `[1-31]`. + The `date.monthDay()` function returns the day of the month for a specified time. + Results range from `[1-31]`. menu: v2_0_ref: name: date.monthDay @@ -10,8 +10,8 @@ menu: weight: 301 --- -The `date.monthDay()` function returns the day of the month for the specified time. -Results are in the range `[1-31]`. +The `date.monthDay()` function returns the day of the month for a specified time. +Results range from `[1-31]`. _**Function type:** Transformation_ diff --git a/content/v2.0/reference/flux/functions/date/second.md b/content/v2.0/reference/flux/functions/date/second.md index afe5c17fb..849ccea6f 100644 --- a/content/v2.0/reference/flux/functions/date/second.md +++ b/content/v2.0/reference/flux/functions/date/second.md @@ -1,8 +1,8 @@ --- title: date.second() function description: > - The `date.second()` function returns the second within the minute the specified time falls in. - Results are in the range `[0, 59]`. + The `date.second()` function returns the second of a specified time. + Results range from `[0-59]`. menu: v2_0_ref: name: date.second @@ -10,8 +10,8 @@ menu: weight: 301 --- -The `date.second()` function returns the second within the minute the specified time falls in. -Results are in the range `[0, 59]`. +The `date.second()` function returns the second of a specified time. +Results range from `[0-59]`. _**Function type:** Transformation_ diff --git a/content/v2.0/reference/flux/functions/date/weekday.md b/content/v2.0/reference/flux/functions/date/weekday.md index 7532ec42e..4ab512c05 100644 --- a/content/v2.0/reference/flux/functions/date/weekday.md +++ b/content/v2.0/reference/flux/functions/date/weekday.md @@ -1,8 +1,8 @@ --- title: date.weekDay() function description: > - The `date.weekDay()` function returns the day of the week the specified time falls in. - Results are in the range `[0, 6]`. + The `date.weekDay()` function returns the day of the week for a specified time. + Results range from `[0-6]`. menu: v2_0_ref: name: date.weekDay @@ -10,8 +10,8 @@ menu: weight: 301 --- -The `date.weekDay()` function returns the day of the week the specified time falls in. -Results are in the range `[0, 6]`. +The `date.weekDay()` function returns the day of the week for a specified time. +Results range from `[0-6]`. _**Function type:** Transformation_ diff --git a/content/v2.0/reference/flux/functions/date/yearday.md b/content/v2.0/reference/flux/functions/date/yearday.md index a05cbb045..0725e9418 100644 --- a/content/v2.0/reference/flux/functions/date/yearday.md +++ b/content/v2.0/reference/flux/functions/date/yearday.md @@ -1,8 +1,8 @@ --- title: date.yearDay() function description: > - The `date.yearDay()` function returns the day of the year the specified time falls in. - Results are in the range `[1, 365]` for non-leap years, and `[1, 366]` in leap years. + The `date.yearDay()` function returns the day of the year for a specified time. + Results range from `[1-365]` for non-leap years, and `[1-366]` in leap years. menu: v2_0_ref: name: date.yearDay @@ -10,8 +10,8 @@ menu: weight: 301 --- -The `date.yearDay()` function returns the day of the year the specified time falls in. -Results are in the range `[1, 365]` for non-leap years, and `[1, 366]` in leap years. +The `date.yearDay()` function returns the day of the year for a specified time. +Results include leap days and range from `[1-366]`. _**Function type:** Transformation_