- 
                Notifications
    
You must be signed in to change notification settings  - Fork 133
 
docs: add datepicker dateType property to input schema #1227
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
                    Changes from 3 commits
      Commits
    
    
            Show all changes
          
          
            12 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      202ef8e
              
                docs: add datepicker isAbsolute/isRelative options
              
              
                mfori 2c0e0a1
              
                mention supported relative units
              
              
                mfori 703212f
              
                change isAbsolute/isRelative to allowAbsolute/allowRelative
              
              
                mfori ab0126c
              
                Merge branch 'refs/heads/master' into feat/datepicker-absolute-relative
              
              
                mfori 8467240
              
                better description and example of input rendering
              
              
                mfori d2f0598
              
                address PR comments
              
              
                mfori e45ca6a
              
                replace allowAbsolute/allowRelative properties with dateType
              
              
                mfori bdacb5d
              
                add pattern to all example properties
              
              
                mfori 5d55dc0
              
                Update sources/platform/actors/development/actor_definition/input_sch…
              
              
                mfori bd909f5
              
                Update sources/platform/actors/development/actor_definition/input_sch…
              
              
                mfori 551d105
              
                Update sources/platform/actors/development/actor_definition/input_sch…
              
              
                mfori d774d41
              
                reformat
              
              
                mfori File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The properties are fine, but I don't understand what they mean well. Perhaps there should be better explanation. Is it:
But what is the returned value is what? Always a date in ISO format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the docs could be improved. The value is always string.
If you set
allowAbsolutetrue(which is the default value, so you do not have to set it), then the datepicker allows user to select a date from a calendar and the final value is stored inYYYY-MM-DDformat and also validated like this.If you pick
allowRelativetrue(which is not the default value), then the datepicker allows user to enter a value in a format+-<number><unit>and the final string value in the field is validated against this format.If you have both set to true, then in the UI you can choose which format you want to use.
It's then up to the actor to correctly parse the value, but it will be validated in UI and in API.
The reason for this logic is that store team needs to have a single field that can be switched between absolute date like
2024-10-08and relative option- 3 days. For example when you want comments on a post from a specific day or for last 3 days relative to when the actor started. They do not want to use two fields because that can then cause confusion.They currently work around this by having a single string field with no validation (or regex). This should allow them to validate the values correctly and help users enter the correct values in a standardized format.
By default if you do not set any of these two properties, the datepicker will behave exactly the same as before and only show a single field with calendar in popover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
allowRelativeexplanation is good, but theallowAbsolutecan be improved. Also could maybe show an example like we do it for other more complicated fields.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, in this case, we should have 2 different editors or "resources types". You should not have varying outputs from a single component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like one function should always return either date object or relative string but not both.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the main requirement from store team is to have a single field, so it's one editor, which can return two different resource types based on users choice, but not both at the same time. Author of the actor can choose which options to allow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense then.