Use date function to return previous, current and next month names

I’m building a calendar picker and have set it up to show the current month in the header using ‘set text’ with the fx [[MonthName]]. I also have a previous and next option in the header and want the month name to update if either is clicked but I can only get it to do this if I display the month as a number and use the fx [[Month -1]]. Is there any way to return the name of the previous or next month?

1 Like

Is there a different purpose of creating the date picker?. If you set the input of the text field to date, then Axure by default provides you the date picker. Refer the image below:



And when previewed, you will get the following:

Yes there is a reason why I don’t want to use the Axure date picker

  1. It doesn’t work in the latest version of Safari
  2. I need it styled differently
  3. I’m trying to extend my skills and gain a better understanding of what can be done using functions.

I don’t have a coding background and can’t find a guide to using functions (e.g. correct syntax etc)

Okey, understood.

Here is the sample for you. I hope this might be heplful:

Select a date first, then press Action button: You will see, the name of the month, day and year below.

More than that, if you would like to use datepicker library, here it goes:

Let me know, if this does not help.

I think it’s getting a bit overcomplicated so have attached a simple example of what I’d like to do
https://share.axure.com/prototype/downloadrpfile/LLTKHM

I can get the month number to increment and decrement but not the month name. It seems like it should very simple but nothing I’ve tried has worked.

if you want to do that you have to use a date object and add and remove time. this date object will then return all the correct values, including day of week or month.

I don’t understand sorry. I thought [[Month]] and [[MonthName]] were part of the date object but the latter will not allow me to increment and decrement.

lets think of the date object like a variable counting milliseconds since january 1st 1970.
the real value is always a number counting milliseconds. with this known source and the value of ms since then you can always calculate the current day, day of week etc. if you add 1.800.001 ms to any sunday 11.30pm and “ask” for the day it will return monday.

here easyDateObject.rp (67.7 KB) you find a simple date-object-calculation with just one returned value.

i am using the axure addHours() function.

1 Like

Thanks for the help. I now have it working the way I want in my test file.

https://share.axure.com/prototype/downloadrpfile/LLTKHM

Hi, how did you manage to show MonthName + 1?

You have to use Month + 1 and then convert to MonthName. Here’s my latest file showing the date picker I was building. Hope it helps.
date pickers 02042018.rp (1.9 MB)

1 Like