Skip to content
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

today() function cannot be used to get today's month #8552

Closed
ilaplain15115 opened this issue Jul 11, 2024 · 1 comment
Closed

today() function cannot be used to get today's month #8552

ilaplain15115 opened this issue Jul 11, 2024 · 1 comment
Assignees
Labels
bug user issue An issue or bug reported by users
Milestone

Comments

@ilaplain15115
Copy link

Are you requesting a feature, reporting a bug or asking a question?

Asking a question

What is the current behavior?

Currently I do not know how to get a single line input question to automatically generate today's date. I want to use the date to trigger question visibility

What is the expected behavior?

I want the current month question to automatically generate todays month. I want question 2 'Seasonal Question' to only be visible if the month is current month question is July.

How would you reproduce the current behavior (if this is a bug)?

Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code

{
 "title": "Github4",
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "text",
     "name": "question1",
     "title": "Current date",
     "questionCategory": "surveyquestion",
     "inputType": "month"
    },
    {
     "type": "paneldynamic",
     "name": "question3",
     "questionCategory": "surveyquestion",
     "templateElements": [
      {
       "type": "matrixdropdown",
       "name": "question2",
       "questionCategory": "surveyquestion",
       "columns": [
        {
         "name": "Column 1",
         "cellType": "boolean"
        }
       ],
       "choices": [
        1,
        2,
        3,
        4,
        5
       ],
       "rows": [
        "Regular question",
        {
         "value": "Seasonal question",
         "visibleIf": "{question1} = '2024-07'"
        }
       ]
      }
     ]
    }
   ]
  }
 ]
}

Specify your

browser: Chrome

browser version: 119.0.6045.160

surveyjs platform (angular or react or jquery or knockout or vue): Angular

surveyjs version: 1.9.112

@JaneSjs JaneSjs self-assigned this Jul 12, 2024
@JaneSjs JaneSjs added question bug user issue An issue or bug reported by users and removed question labels Jul 12, 2024
@JaneSjs JaneSjs assigned andrewtelnov and unassigned JaneSjs Jul 12, 2024
@JaneSjs
Copy link
Contributor

JaneSjs commented Jul 12, 2024

Hello @ilaplain15115,
The today() function should be used to set a today's date as a default question value.

 {
   "type": "text",
   "name": "question1",
   "title": "Current date",
   "defaultValueExpression": "today()",
  "inputType": "month"
}

However, the month entry field cannot currently parse the supplied default value in UTC format and convert it to a month input format. I'll forward this issue to our developers for further investigation. We'll update you as soon as we get any news to share.

andrewtelnov added a commit that referenced this issue Jul 12, 2024
@OlgaLarina OlgaLarina added this to the v1.11.7 milestone Jul 16, 2024
@RomanTsukanov RomanTsukanov changed the title Auto populate today's month today() function cannot be used to get today's month Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug user issue An issue or bug reported by users
Projects
None yet
Development

No branches or pull requests

4 participants