Show only specific days on calendar - bash

I want to know if it's possible to show only specific days in a calendar. I mean, for example, I know that I can create a dialog box with a calendar using:
dialog --title "Test" --calendar "Date:" 0 0
And it shows every day on the specific months and so on.
But I want to know if I can show only the days like 5, 10, 15, 20, 25, 30 in the same dialog box, but I don't know how to do it or if it can be done that way using that dialog option.

dialog does not do what was asked. Source code is provided; you could modify it.
The documentation says
--calendar text height width day month year
A calendar box displays month, day and year in separately adjustable windows. If the values for day, month or year are
missing or negative, the current date's corresponding values are
used. You can increment or decrement any of those using the
left-, up-, right-, and down-arrows. Use vi-style h, j, k and l
for moving around the array of days in a month. Use tab or
backtab to move between windows. If the year is given as zero,
the current date is used as an initial value.
On exit, the date is printed in the form day/month/year. The
format can be overridden using the --date-format option.
and
--date-format format
If the host provides strftime, this option allows you to specify
the format of the date printed for the --calendar widget. The
time of day (hour, minute, second) are the current local time.
While the --calendar description refers to an array of days, and separately adjustable windows, it does not go into excessive detail to note that the windows for month, day and year are used to update the array, and that the widget shows all of the days for each month.
The --date-format option is used to change the way the result is reported to the shell, and has no effect on the way the month is shown on the screen.

Related

SSRS Indicator by Date Condition

I'm new to SSRS reporting and having some problems with indicators. I am trying to use an indicator to show how long a reservation has been open based on the number of days between the current date and the RequirementDate (which is a field in the dataset).
What I want logically is this:
If number of days is less than 6 months old, show green
If number of days is between 6 months and 8 months, show yellow
If number of days is greater than 8 months, show red
Also, I'm not sure where I would enter this kind of formula, as I am doing this from the Indicator Properties window.
To set these options go into the indicator properties. The easiest way to do this is to right click on the center of the indicator and click Indicator Properties. Then click on Value and States.
Setting the Green, Yellow, and Red ranges is straight forward for your use case. Just fill in the start and end values with the range of days you want. To set the expression you want for the value click on the fx button next to the value field and use an expression like this one to calculate the days between a date and report runtime.
=DateDiff(DateInterval.Day, Max(Fields!RequirementDate.Value), Now())

using UIDatePicker with only day and month swift

I am making an app, uses UIDatePicker component. Everything works fine with the below code.
myDatePicker.datePickerMode = UIDatePickerMode.Date
My problem is here how to avoid the year column, days and months are the only data that i want to show in the component.
Like:
2 November
3 November
thanks
This is a bit tricky but if you don't have to deal with date formats and locale it may work for you.
Place the UIDatePicker inside a UIView and align all sides to the containing view's edges. Then change the right side constraint from 0 to -100 (you may have to find a different number depending on the size you want to give it).
In the containing UIView's User Defined Runtime Attributes add a key named clipsToBounds, make it a Boolean and make sure it is checked.
This will hide the edge of the Date Picker that is aligned beyond the UIView's right side.
Make sure you set a minimum and maximum date for January 1st to December 31st of a specific year (so the user doesn't accidentally go outside that year and you don't have to deal with multiple years).

NSDatePicker commits subfield changes on a timer

I'm using a plain NSDatePicker control with NSYearMonthDayDatePickerElementFlag. It's the same as the date picker on the "date & time settings" panel with MM/DD/YYYY fields (the text box with 3 subfields, not the calendar portion). My users are getting stuck typing the digits into the year sub-field (though the behavior is present on the month and day fields too).
You can reproduce the problem using the Date & Time settings panel. Uncheck "Set date & time automatically" and click on the current year part of the field, 2014. Now just type 19 and pause. After about 1 second it fires some event and changes the date to 1969.
My users don't seem to type as fast as the NSDatePicker expects them to. Some event fires, calling some internal function NSDatePickerCell(NSTextFieldWithStepperDatePickerInternal)_userEditExpired:, well before many of my users can finish entering the 4 digit year. The timeout is reset after each keystroke, and seems about a second or a little less.
Does anybody know of a way to defeat that behavior without resorting to writing a whole new date picker? I'd be happy with a way to just change the timeout to something longer, maybe about 5 seconds, so the slower typists can get all 4 digits entered without the event firing and accepting their input before they're finished.

NSDatePicker failing to refresh when setting date to current date

I have an NSDatePicker with an associated NSButton that changes the current date to "Today" when pressed.
However: When the date is currently January 4th, 2014, and I use the built-in arrow buttons to switch to a different month without changing the actual selected date, there seems to be no way to get the calendar to refresh. Here's a video of the issue:
Video of the Issue: https://www.dropbox.com/s/ay7fljnoyxb06ua/Calendar%20Test%20Video.mov
See the attached sample project for an example. To reproduce:
Click "Today"
Click the right-arrow button to switch to a different month (without selecting an actual day)
Click "Today"
The NSDatePicker seems to fail to refresh if you're programmatically selecting a date that is not in the currently-viewed month, and if the date that it is switching from is in a different month as well.
But, the date is properly picked. If you use the buttons to select a date, then manually browse back to the proper month, the date has been selected. But the calendar never shows you that month automatically, unless the date you're switching from is in the currently-viewed month.
Sample Project: https://www.dropbox.com/s/tnpox2mt5f5z2nb/CalendarTest.zip
I would file this as a bug against the API since there are no methods in the class that suggest you'd have to ask it to refresh manually (I'd assume setting the selected date would automatically display the proper range to show that selection).
As a work-around, you might try asking it to display ( -setNeedsDisplay:YES ) or manually twiddling its min/max range after setting the date, then setting it back to unlimited immediately after. Maybe that'll kick-start it into displaying the correct range for the selected date.

What's the best approach to get Date/Time input from the user?

This is a wheel that's been re-invented again and again over the years.
The Problem: The user needs to input a Date/Time
Basic considerations
We want to make it as easy as possible for the user to enter the desired date/time
Some applications call for historical dates, some applications call for future dates only, some will need to handle both
We want to prevent the user from entering jibberish data
We want to auto-populate this control as aggressively as possible.
We want this control to be as re-usable as possible.
Popular solutions include:
Text Boxes
Combo Boxes
Pop-out calendars
Server-side and/or client-side validation
Various ways of alerting the users about bad data
There are a panoply of ready-to-eat solutions about, but I'm looking for some more general information. Have there been any usability studies done on the various date-time-control approaches? Is there a "best" date-time control out there? Are there any well-established "Dos and Don'ts"?
Related question: Best GUI control(s) to describe a time range
My preference is for a text input with an elipsis button next to it:
Enter a date [ ] [...]
The elipsis would pop up a calendar to populate the text input, but the user can type in a date if they want. Validation should be done when the "OK" button for the form is pressed - trying to do date validation on a character by character basis is doomed, in my experience.
The validation should be sophisticated and allow expressions like
"today"
"Tomorrow"
"23 Jan"
etc.
Edit: In reply to some comments, one could do validation when the text edit loses focus (though I hate that kind of thing) in which case the edit content could change from "23 Jan" to "23-01-2009" to indicate that the exprssion was understood.
Give me a calendar to select the date with a mouse. And let me type the date in with the keyboard. Accept as many formats as possible. If I need to enter December 21, 2012, let me use:
Dec 21 2012
21DEC2012
December 21 2012
12/21/2012 (or 21/12/2012, pick one, perhaps depending on what country I'm using the software in)
12212012 (same parenthetical fragment as above)
Etc.
Whatever you decide to do to solve the localization issue, make sure it's obvious what you expect. Give me an example, or a template with MMDDYYYY that I can type over.
Please don't give me pull-down boxes where I have to scroll, especially through years. If I'm old, and I'm entering my DOB, I don't have enough time left in my life to scroll down to the bottom of your pull-down box. Pull-down boxes are a good pattern to use when I don't know what the options are, but if it's something I'm very familiar with, like my birth date, then pull-down menus are a hassle.
Now, WRT time inputs (Big pet peeve), don't assume that I meant 3 am. If I enter 3 for the time, assume I meant 3 pm. Make me do extra work to schedule something at 3 am. If you're uncomfortable with assuming that much on my behalf, at least alert me that I've scheduled something for 3 am so I can fix it now instead of later when someone on my event invitation list emails and says "You moron, you scheduled our D&D Meetup for 3 am!"
I think the date range entry on Google Calendar is quite good. You can enter by keyboard or by mouse. The only quibble would be in entering dates for a different year.
You can do it easily enough via the keyboard, but they should have a second set of little arrows on the calendar to jump a year at a time back or forth using the mouse.
EDIT: In response to the question, "What if you want to schedule an event that goes from 11PM on Tuesday till 1AM on Wednesday (say a daily build, for instance)? How do you wrap the time over midnight?"
If the "to" time pushes it over midnight, then roll the "to" date to the next day. That would just be part of the business logic of the component. You'll notice in the second image above, the drop-down indicates both the end time and the duration of the event, which should be a hint.
If you try and put an end date earlier than the start date, you can highlight the background colour of the fields and/or show an error message on save.
Play around on Google Calendar and see how it behaves.
I'd suggest you also allow for users who like to type rather than click on a calendar control, so a combination of text box + popup calendar works well.
We created a custom control with just such a combination. User can type a date in a variety of formats in the textbox, or click on a button to pop up the calendar.
We allow all sorts of input like "today", "wed", or "+2" (for day after tomorrow) and use regular expressions for most of the validation client side. We also do server side validation of course.
The control also has an optional textbox for time which can be enabled or hidden by a property. We felt it was easier to separate date from time. For times, we allow "9pm", "2100", "09:00" etc.
The control caters for a min and max date, so that date of birth can have a range from say -100 years to current year, while credit card expiry might range from current year to +5 years, and so we use range validators.
A text box with an image-link to a pop-out calendar on the side is my choice. Best of both worlds.
If you want something extra you could let a natural language date/time parser like Chronic http://chronic.rubyforge.org/ spice it up.
Also don't forget the international users.
If you're going for the combo-box/list-box option make sure you make the months read "Jan","Feb"..."Dec" rather than "1","2"..."12".
It's rather annoying having to figure out which slot is the month and which is the day according to the ranges of the values.
I'd go for three alternatives depending on the situation:
2 combo boxes. One listing year + month, another the day
3 combo boxes. One listing years, one month, one days
Visible calendar/s and combos like this one from YUI
And I believe there are more options from which I'd choose.
You need to check your UI requirements. If you want script-enabled support only, they you can go with any of your panopoly of scripts and run with whatever date/time format they provide into a hidden field.
However, if you need the user entry in a textbox, then you're faced with some decisions:
Is the date/time format rigid? e.g. mm/dd/yyy hh:mm:ss format only?
Or loosely defined, to allow for the "today", "tomorrow", "23 Jan" style entries?
Will the formats be locale-specific? e.g. mm/dd/yyyy vs. dd/mm/yyyy
Validation methods depend on your decisions on requirements.
I like the jQuery date-picker plugin. It'll allow output in specific formats.
A calendar showing multiple months continuously: http://www.cs.helsinki.fi/u/salaakso/patterns/Calendar-Strip.html
I've always found Google Calendar easy to use in this respect. You could certainly do worse than trying to emulate it. The key is to give the user a lot of flexibility in how they enter information. For example, I can select a time from a drop down list or type it in manually, and when I type, I'm not required to include the colon or the "m" in "pm".
I really like the way QT4's Date/Time widget works.
You can enter dates manually (type in the date, in common formats).
You can use your scroll wheel to quickly change date/time fields.
You have an expandable calendar that has drop down months and forward/backward arrows for the months. You can click on specific days and enter the year manually, or with a combo box (scroll wheel works here too).
Here is a short video (~7.5MB) that shows how the widget works and what some of its features are: Video Here
I would expect any sophisticated application to have some or all of these features.
Being able to enter relative dates (today, last week, 3 days ago) is handy, but I'm not sure how practical it would be, given standard questions like "What is your date of birth?", or "When would you like X emailed to you?".
you can use plugin cxcalendar. It looks like other datepicker. but you can pick year and month in select after clicking year-month title.

Resources