Skip to content

Commit 970fe42

Browse files
authored
Feature/gu UI 3670 - use 24-hour time in datepicker (#25)
* bugfix: spatial constraints not ready * 0.0.152 * bugfix: add debugging * 0.0.153 * bugfix: more debugging * 0.0.154 * remove debugging * 0.0.155 * remove watch * 0.0.156 * resolve issues * 0.0.157 * Filter out non-configured giovanni variables * 0.0.158 * handle groups in giovanni variable names * 0.0.159 * drop help icons and update text * 0.0.160 * feature: datepicker sidebar slots * feature(badge): add info variant * feature(dialog): borders * 0.0.161 * include composed-offset-position * 0.0.162 * feature(date-picker): switch to 24 hour time, clean up date handling and add tests * feature(date-picker): preserve time * 0.0.163 * fix warning about datepicker using inefficient updates * 0.0.164 * feature(date-picker): attempt to fix additional day * chore: formatting * 0.0.165 * feature: add clear functionality * 0.0.166 * handle loading and error states for collection
1 parent a8ebe9d commit 970fe42

16 files changed

Lines changed: 1253 additions & 240 deletions

File tree

docs/pages/components/date-picker.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Use help text to display the desired date formatting, in case visitors choose to
6161
| `startLabel` | `start-label` | `string` | - | Custom label for the start date input (only used when `split-inputs` and `range` are true) |
6262
| `endLabel` | `end-label` | `string` | - | Custom label for the end date input (only used when `split-inputs` and `range` are true) |
6363
| `hideLabel` | `hide-label` | `boolean` | `false` | Visually hide the label while keeping it accessible |
64-
| `enableTime` | `enable-time` | `boolean` | `false` | Enables time selection UI (12-hour with AM/PM) |
64+
| `enableTime` | `enable-time` | `boolean` | `false` | Enables time selection UI with 24-hour UTC format including hours, minutes, and seconds |
6565
| `displayFormat` | `display-format` | `string` | `YYYY-MM-DD` or `YYYY-MM-DD HH:mm:ss` | Display format for the input value |
6666
| `showPresets` | `show-presets` | `boolean` | `false` | Shows a sidebar with preset ranges; shown if preset overlaps `min/max`. Hidden if none remain |
6767
| `presets` | `presets` | `PresetRange[]` | `[]` (auto-fill) | Custom preset ranges; when empty, a default set is provided |
@@ -76,6 +76,7 @@ The component emits:
7676
- Event `detail`: `{ startDate: string, endDate: string }`
7777
- If `enable-time` is off, values are `YYYY-MM-DD`
7878
- If `enable-time` is on, values are ISO strings (e.g., `2024-03-20T10:00:00.000Z`)
79+
- When using time with ranges, the end time defaults to 23:59:59 (end of day) while start time defaults to 00:00:00
7980

8081
## Examples
8182

@@ -109,6 +110,13 @@ The component emits:
109110
start-date="2024-03-20T10:00:00Z"
110111
end-date="2024-03-25T15:30:00Z"
111112
></terra-date-picker>
113+
114+
<terra-date-picker
115+
id="range-time-picker"
116+
range
117+
enable-time
118+
split-inputs
119+
></terra-date-picker>
112120
```
113121

114122
### Custom Display Format

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nasa-terra/components",
33
"description": "A collection of NASA Earthdata components",
4-
"version": "0.0.162",
4+
"version": "0.0.166",
55
"homepage": "https://github.com/nasa/terra-ui-components",
66
"author": "NASA GES DISC <https://disc.gsfc.nasa.gov>",
77
"license": "MIT",
@@ -59,7 +59,7 @@
5959
"create-widget": "plop create-widget --plopfile scripts/plop/plopfile.js",
6060
"update-widget": "plop update-widget --plopfile scripts/plop/plopfile.js",
6161
"test": "web-test-runner --group default",
62-
"test:component": "web-test-runner -- --watch --group",
62+
"test:component": "web-test-runner -- --group",
6363
"test:watch": "web-test-runner --watch --group default",
6464
"spellcheck": "cspell \"**/*.{js,ts,json,html,css,md}\" --no-progress",
6565
"list-outdated-dependencies": "npm-check-updates --format repo --peer",

packages/create-terra-ui-app/boilerplates/nextjs/framework.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function create(nextTask, outputDir, boilerplatesDir, appName) {
6767
"import { setBasePath } from '@nasa-terra/components/dist/utilities/base-path.js'"
6868

6969
// Create the setBasePath call with comments (with newline before it)
70-
const setBasePathCall = `\n/**\n * Sets the base path to the Terra UI CDN\n *\n * If you'd rather host the assets locally, you should setup a build task to copy the assets locally and\n * set the base path to your local public folder\n * (see https://terra-ui.netlify.app/frameworks/react/#installation for more information)\n */\nsetBasePath('https://cdn.jsdelivr.net/npm/@nasa-terra/components@0.0.162/cdn/')`
70+
const setBasePathCall = `\n/**\n * Sets the base path to the Terra UI CDN\n *\n * If you'd rather host the assets locally, you should setup a build task to copy the assets locally and\n * set the base path to your local public folder\n * (see https://terra-ui.netlify.app/frameworks/react/#installation for more information)\n */\nsetBasePath('https://cdn.jsdelivr.net/npm/@nasa-terra/components@0.0.166/cdn/')`
7171

7272
// Reconstruct the file: CSS import at top, then existing content with setBasePath import and call inserted
7373
const newLines = [...lines]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
55
[project]
66
name = "terra_ui_components"
77
dependencies = ["anywidget>=0.9"]
8-
version = "0.0.162"
8+
version = "0.0.166"
99
readme = "README.md"
1010
description = "NASA Terra UI Components Library"
1111
requires-python = ">=3.8"

src/components/data-access/data-access.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,7 @@ export default class TerraDataAccess extends TerraElement {
311311
this.startDate = detail.startDate || ''
312312
this.endDate = detail.endDate || ''
313313

314-
if (this.startDate && this.endDate) {
315-
this.#gridApi?.purgeInfiniteCache()
316-
}
314+
this.#gridApi?.purgeInfiniteCache()
317315
}
318316

319317
#getDateRangeButtonText(): string {

src/components/data-access/data-access.controller.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,6 @@ export class DataAccessController {
7171
],
7272
{ signal }
7373
) => {
74-
console.log(
75-
'fetch granules',
76-
collectionEntryId,
77-
startRow,
78-
endRow,
79-
sortBy,
80-
sortDirection,
81-
search,
82-
cloudCover
83-
)
84-
8574
if (!collectionEntryId) {
8675
return undefined
8776
}

src/components/data-subsetter/data-subsetter.component.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,25 @@ export default class TerraDataSubsetter extends TerraElement {
316316
const title =
317317
this.collectionWithServices?.collection?.EntryTitle ?? 'Download Data'
318318

319+
if (!this.collectionWithServices) {
320+
if (this.controller.fetchCollectionTask.status === TaskStatus.PENDING) {
321+
return html`
322+
<div class="loading-collection">
323+
<terra-loader indeterminate variant="small"></terra-loader>
324+
<span>Loading</span>
325+
</div>
326+
`
327+
}
328+
329+
if (this.controller.fetchCollectionTask.status === TaskStatus.ERROR) {
330+
return html`
331+
<terra-alert open variant="danger" appearance="white">
332+
Failed to find the requested collection.
333+
</terra-alert>
334+
`
335+
}
336+
}
337+
319338
const content = html`
320339
<div class="container">
321340
${!this.dialog

src/components/data-subsetter/data-subsetter.styles.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ export default css`
2121
background: white;
2222
}
2323
24+
.loading-collection {
25+
display: flex;
26+
align-items: center;
27+
}
28+
29+
.loading-collection terra-loader {
30+
margin-right: 8px;
31+
}
32+
2433
.header {
2534
display: flex;
2635
align-items: center;

src/components/data-subsetter/notebooks/subsetter-notebook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function getNotebook(host: TerraDataSubsetter) {
2121
{
2222
id: '2733501b-0de4-4067-8aff-864e1b4c76cb',
2323
cell_type: 'code',
24-
source: '%pip install -q "terra_ui_components==0.0.162" "anywidget==0.9.15"',
24+
source: '%pip install -q "terra_ui_components==0.0.166" "anywidget==0.9.15"',
2525
metadata: {
2626
trusted: true,
2727
},

0 commit comments

Comments
 (0)