Need to sample-testing a calendar application against invalid dates - validation

I am testing a calendar application, which allows a user to select day, month and year, but the problem is the developers have not implemented any form of date validations, which means every month can have up to 31 days.
The year dropdown menu has a range from 1900 to 2016,
the month dropdown menu has Jan, Feb ... Dec,
the day dropdown menu always has 1~31, regardless of which month I choose.
The testing strategy I am thinking of is:
choose one non-leap year and test against 29th Feb; expected to fail
choose one non-leap year and test against 31st April; expected to fail
choose one leap year and test against 29th Feb; expected to succeed
choose one leap year and test against 31st April; expected to fail
Four scenarios above should provide a good coverage regarding leap years and invalid dates.
What are your opinions? Am I missing anything?

Related

In PowerBI DAX, trying to capture greatest fiscal month user has filtered on

In my PowerBI, the user can filter on fiscal years and fiscal months. In a custom column, I need to capture the fiscal period number of the greatest fiscal month that the user has filtered on. For example, if the user selects fiscal year 2019 and fiscal months April through October, in the custom column I need 201907 (my fiscal year runs April to March, so October is 07). I have tried variations of this
FilteredFP =
CALCULATE(
MAX(Dates[FiscalPeriod])
)
But the result is always all seven fiscal periods (201901, 201902, ...). Thank you for any help you can provide!

Complex Date Range

I'm working on the following query and cant figure out the final piece of it. I need my query to give me a result set between the previous business and the previous business day minus (-) 28 days. (e.g. date range between 10/28/2015 and 10/28/2015 -28) The query that I wrote so far is only giving me the -28th day (09/30/2015) and NOT a range in between the previous business day and the previous business day -28. My research shows a couple of different ways of doing it and so far none have worked for me.
SELECT SMBL, SUM(NET_FLOWS/1000000.00)
FROM HISTORY
WHERE DATE - 28 = DATE AND DATE = TO_DATE('10282015','MMDDYYYY')
AND SYMBOL IN ('AAA','BBB')
GROUP BY SMBL
First off, date ranges are easy using BETWEEN, so you do the quick solution:
WHERE DATE BETWEEN (SYSDATE-28) and (SYSDATE-1)
Then you realize your dates have time components, so to include all of yesterday and all of day-28 you need to:
WHERE DATE >= TRUNC(SYSDATE)-28
AND DATE < TRUNC(SYSDATE)
Then I look at your rule "previous BUSINESS day" and ask - what are your business days? On a Monday to go up to the previous Friday? Or Saturday? Or are you a 7-day-a-week business? How about statutory holidays? And is it 28 CALENDAR days back? Or 28 BUSINESS days?
Ahh business rules. The devil is always in those details....

Excel VBA - Year to Date validation

I have a variable input in my Userform for the start of the Financial Year. I want to be able to validate the entry, so that it will prompt the user if the date entered is not the a start date for a financial year.
Eg.The start of my Financial year is 01 Jul 2012, so if I was running a report for the month's Jul 2012-Jun 2013 the Financial is entered will not come back with an error message. But if the monthly report I'm running is "Jul 2013", or "Aug 2013", and my YTD entered is "Jul 2012", I want an alert to say "Do you want to reset your YTD entered?"
Thanks.
There is a lot you aren't explaining... your first example is a 12-month report, then later you mention monthly reports. Using your example, if the monthly report is running starts Aug 2013. Is the user input that raises the prompt ALWAYS wrong, or only sometimes?
Regardless, things like the first day of the year don't change. Why not simply hardcode the first day of the last & next 20 (?) fiscal years, and verify the user's input matches one of them. I would actually suggest in-cell Data Validation (validating against a List comprised of the first days) but you stated you were using a UserForm.

How to change the starting date of a Calendar Year to something other than Jan 1st?

I'm writing an app that relies on the calendar and calendar events to display data to the user.
I need to be able to let the user select the beginning of his/her 'fiscal' year in settings, which will be the 1st of any of the 12 months. This is an app for military users, and any given unit's fiscal year can begin on whatever month their unit (base) decides.
The data I'm displaying to the user needs to be divided into 'fiscal' quarters according to the user's setting of the beginning of the fiscal year, not calendar year.
I'm not having problems retrieving, editing or deleting the events, I can't figure out how to change the beginning of the year to anything besides Jan 1st.
I found NSDateCategoryForReporting on GitHub, that seems like it's exactly what I need, but how do I tell it that the year begins on the 1st of x month?
iOS doesn't natively support this, so you'll have to find a plugin to do this or write your own. Your best bet is to write a class that performs the date conversions using the standard NSDate, NSCalendar, etc.
For instance, you could store what day the user specifies as their starting fiscal year. Then you can calculate the number of days difference between that and January 1st, and just shift dates based on that.

How do I calulate week of year in Oracle using a non-standard first day of the week?

I have a query that needs to return the "week of year" of a date field but the customer of the query uses a non-standard first day of the week so TO_CHAR with 'IW' isn't returning the expected result. In this case the first day of the week is Saturday and Friday is the seventh day of the week.
With T-SQL I'd use DATEPART and SET DATEFIRST.
What is the Oracle equivalent? The Oracle answers I've found in the google all talk about setting the NLS_TERRITORY like so ALTER SESSION SET NLS_TERRITORY = 'UNITED KINGDOM'; but I'm not seeing where I can pick an arbitrary day (other than perhaps finding a territory that uses Saturday).
IW works with a Monday - Sunday week, so this should get you what you are looking for. Basically, get the week according to the day 2 days from now:
to_char(your_date + 2, 'IW')
Oracle's default week format calculates the week number from the first day of the year instead of the first day of the week.
So if a year starts on 01-jan-2009 and the first day is on Wednesday, the week No. 1 will be from 01-jan-2009 to 08-jan-2009 (wednesday to tuesday).
You can use the "iw" format (and a little tweak) if you need the week range to start from sunday through saturday. http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10749/ch9sql.htm#CIHGFJEI
Try this code below. I basically use the "IW" format and add a condition to get the week number to start from a given date.. say...01-jul-2008.
select target_date,
to_char(target_date+1,'iw') week_sun_thru_saturday,
to_number(to_char(target_date+1,'iw')) -
to_number(to_char( to_date('10-jul-2008','dd-mon-yyyy')+1,'iw')) week_from_01_jul_2008
from t;
Remember..This code will not give week number 1 from jul1st to jul-07 .unless of course 01-jul-2008 is a sunday ;)

Resources