influxdata / influxdata/docs-v2
Confusing line configuration in the "Truncate time values" code example.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 82
- Forks
- 326
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 82
Description
I looked up the syntax for the date.truncate() function in flux and was very confused with the given line breaks in the example.
```
import "date"
import "timezone"
option location = timezone.location(name: "Europe/Madrid")
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1s)
// Returns 2019-06-03T13:59:01.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1m)
// Returns 2019-06-03T13:59:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1h)
// Returns 2019-06-03T13:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1d)
// Returns 2019-06-02T22:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1mo)
// Returns 2019-05-31T22:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1y)// Returns 2018-12-31T23:00:00.000000000Z
```
It seems like something went wrong with formatting this section. I read the comments over the respective code lines to be related, but it seems like the comment below the code line (after the line break) is the relevant one. I suggest changing the formatting to this:
```
import "date"
import "timezone"
option location = timezone.location(name: "Europe/Madrid")
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1s)
// Returns 2019-06-03T13:59:01.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1m)
// Returns 2019-06-03T13:59:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1h)
// Returns 2019-06-03T13:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1d)
// Returns 2019-06-02T22:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1mo)
// Returns 2019-05-31T22:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1y)
// Returns 2018-12-31T23:00:00.000000000Z
```
This would massively improve the readability.
##### Relevant URLs
- https://docs.influxdata.com/flux/v0.x/stdlib/date/truncate/
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the linked date.truncate() documentation page and inspect the “Truncate time values” code example. Keep each returned-value comment directly beneath its corresponding call, then verify that the rendered example matches the formatting proposed in the issue.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100