Skip to content

feat(carbon): add string variant of timepicker #1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2021

Conversation

rvsia
Copy link
Contributor

@rvsia rvsia commented Oct 11, 2021

Fixes see discord

Description

useStringFormat

If set to true, then the value is stored as a string. You need to parse it yourself. You should also provide a proper validation, currently the component does not check what users enter.

Examples:

12:04

12:04 PM

12:04 PM EST (timezone's value is being used)


If not set (or set to false), then the value is stored as a Date. You need to use getHours (see more) and getMinutes (see more) to obtain the values in your submit function.

Schema (if applicable)

            schema={{
              fields: [
                {
                  component: 'time-picker',
                  name: 'time-picker',
                  twelveHoursFormat: true,
                  timezones: [
                    { label: 'EST', value: 'est' },
                    { label: 'PST', value: 'pst' },
                  ],
                  useStringFormat: true,
                },
              ],
            }}

@rvsia rvsia added enhancement New feature or request Carbon PRs/Issues for IBM's Carbon design system labels Oct 11, 2021
@rvsia rvsia requested a review from Hyperkid123 October 11, 2021 13:35
@DataDrivenFormsBot
Copy link

A new version (feat) will be released: v3.13.0 [DataDrivenFormsBot]

@codecov
Copy link

codecov bot commented Oct 11, 2021

Codecov Report

Merging #1137 (39a99ac) into master (a5ab931) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1137      +/-   ##
==========================================
+ Coverage   94.88%   94.91%   +0.03%     
==========================================
  Files         205      208       +3     
  Lines        3520     3541      +21     
  Branches     1214     1222       +8     
==========================================
+ Hits         3340     3361      +21     
  Misses        180      180              
Impacted Files Coverage Δ
...nt-mapper/src/time-picker-base/time-picker-base.js 100.00% <100.00%> (ø)
...nt-mapper/src/time-picker-date/time-picker-date.js 100.00% <100.00%> (ø)
...apper/src/time-picker-string/time-picker-string.js 100.00% <100.00%> (ø)
...on-component-mapper/src/time-picker/time-picker.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5ab931...39a99ac. Read the comment docs.

@Hyperkid123 Hyperkid123 merged commit de36488 into data-driven-forms:master Oct 13, 2021
@GilbertCherrie
Copy link
Contributor

@rvsia This pr also needs to be back-ported to branch v2 should I include it in my pr?

@rvsia
Copy link
Contributor Author

rvsia commented Jan 18, 2022

@GilbertCherrie yep, include anything you need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Carbon PRs/Issues for IBM's Carbon design system enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants