Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JQL birthday current month

Dante Labate
Contributor
April 12, 2018

Community...

 

I am using an instance of JIRA to manage the registration of people supported by an NGO that helps people who are going through needs.

One of the custom fields that creates the date picker type and is populated with the date of birth.

I'm trying to create a JQL query and list the problem that has the birthday date for the current month, but I'm not getting ...

Can someone help me?

project = cb and "date of birth" >= startOfMonth() and "date of birth< endOfMonth(1)

 

image.pngimage.png

2 answers

0 votes
Dante Labate
Contributor
April 16, 2018

I made some changes to the original question.

Does anyone have any ideas?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2018

I think you'd need to code a JQL function to do this, or code a scripted field that pulled the month out separately.

The problem for you with the start and end functions you have tried to use is they really do mean "the current month" (or +/- x months), and they look at the whole date.  April last year won't be returned in start/end because it was last year.

Dante Labate
Contributor
April 16, 2018

I realized this but as the startyear function exists, I thought it would look exclusively for the month.

 

I also own the scriptrunner, could you help me with this script that isolates me only the month of this date field?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2018

Ah, well that makes it easy.  I'm not so hot on JQL functions. or even coding, but a scripted field will do the job:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def birthdayField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "Birtday field name"}
return issue.getCustomFieldValue(birthdayField).getMonth()

 This assumes the field is always filled, and you want a 1-12 number back from the date.

Dante Labate
Contributor
April 16, 2018

Nic

Yes, it is populated in the creation of the issue.

 

Many thanks for the help, I can not test at this time, but I put the result here as soon as possible.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2018

Please go easy on my coding skills - I have not been a real developer since 2004, and even then I wasn't writing Java or Groovy (Pro-IV in case you've ever heard of that).  I wrote that from memory, but I think it's broadly correct.

0 votes
Matt Doar
Community Champion
April 12, 2018

ONG: Abbreviation in French, Italian, Spanish, Romanian and Portuguese for non-governmental organization (NGO in English)

Perhaps:

project = cb and "date of birth" >= startOfMonth() and "date of birth" < endOfMonth(1)

Dante Labate
Contributor
April 12, 2018

Tanks Matt, 

 

Sorry, I was wrong to enter information, I already tested that way and it does not work, it seems that it is also taking the year into consideration

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events