Mobiscroll datetime, remove all validation - mobiscroll

I'm prototyping this date picker with a client. They are finding it very confusing that you need to pick year first before other months and days become available for selection (which is fair enough).
We do date validation on the backened anyway, so is there anyway to remove the disabling of invalid dates so the user can choose anything they want immediately, instead of following the required pattern of year -> month -> day selections.
I couldn't find anything in the docs.

This was resolved by not including maxDate, even if it was null

Related

Data Studio - Grouping by Week

I have a simple Data Studio table consisting of two columns. The first column is the week (ISO Year Week) and the second column is the total registrations we've received for that week.
However, my Week column repeats 7 times (7 Rows) for each week as it's counting by day within that week. See below:
Is there any way to get this to group by the listed week? Below are my settings:
Dimension = Conversion Date set as "ISO Year Week" for the type.
Metric = Equals the count of Conversion Date (Same Conversion Date field used for dimension)
Any help would be much appreciated.
There might be an issue with the date format of the source. Without knowing the source (e.g. Google Analytics or Sheets) it’s hard to tell.
Blended Data
I recently had this issue with blended data. The response of a similar question helped me to find a way.
Basically you have to add a new custom field to the data source with the formula WEEK(date_field_link). Data studio will recognise this as a date in compatibility mode, but for me it still works. Then you can use this new date field as a join key to blend the data while grouping it in weeks.
Normal Data
If this problem appears in a regular non-blended dataset you might want to check if Data Studio correctly catches the date as a date. This help article from Google might be worth checking out: https://support.google.com/datastudio/answer/6401549?hl=en#zippy=%2Cin-this-article
I made a similar case work using blended data.
Your column "Conversion Date" repeats the same week 7 times because it's just a display value. Every row has a date value (year, month and a day) but you're just showing the corresponding week. So, data-studio treats them as different data and doesn't group them.
To be able to group them by Week you need to create a new field with a value containing only the week and the year. So, you can use the formula
YEARWEEK(your_date)
The resulting Date will be groupable.
NB1: If your date isn't of the type Date, you can parse it from text to date using
the method:
PARSE_DATE("%Y-%m-%d", your_date_text)
NB2: If the created field has the type number and doesn't show the possibility to change type to Date, you can do this trick: (it's weird but it works):
First type as a formula for the created field and apply:
MONTH(your_date)
This will unlock the compatibility Date types. You can choose from them the ISO Year Week type.
and then change the formula from MONTH(your_date) to YEARWEEK(your_date) [your formula] as I explained above. The chosen date type won't go away even if it wasn't available the first time.

Less if else conditions in angularjs

I have 2 main dates : MainFrom and MainTo Depending on these , I have set validations for my work experience date validations in angularjs(I know, it is old but the proejct was written in this version). I can add from and to experience dates.Validation needed:
Main From date > Main To date
other Experince dates should be between these dates.
Other work experience to date should be greater than from date.
I have written lot of conditions to check these.
Could someone suggest less lines of code?
to go with the trend these day try moment in you angularjs app,
first include moment js in your project, the lib will help you in all validations and checks related to dates.
for eg in your cases validation check will something like this:
Main From date > Main To date :
if(moment(Main From date).isAfter(Main To date))
other Experince dates should be between these dates. :
loop on every date
if(moment(other Experince dates).range(startDate, endDate);)
Other work experience to date should be greater than from date.
if(moment(to date).isAfter(Main from date))

Alexa AMAZON.DATE slot default to past dates

I am using the AMAZON.DATE slot and I would like it to default to past dates.
For example, if a user says Monday I would like it to automatically select last Monday rather than next Monday.
In the documentation it confirms that it defaults to 'on or after the current date':
"Utterances that map to a specific date (such as "today", "now", or
"november twenty-fifth") convert to a complete date: 2015-11-25. Note
that this defaults to dates on or after the current date (see below
for more examples)."
For my application there is no way a future date would make sense so it wouldn't be too difficult to manually program this in but I just wondered if there was any other way of doing it?
No, you cannot change the behavior of built in slots, so if Alexa resolves user's answer as a date - before passing it to your further processing just subtract 7 from resolved value. It will give you the date in the past.

angularjs - confusion with date formats

I am super confused with date formats and need some clarifications. I am trying to pre-populate a form with a date and have set $scope.selectedDate = c.data.Appt.enrolled.start_date;
In my console, c.data.Appt.enrolled.start_date is a string:
However, when I set $scope.selectedDate to that, nothing shows up.
Conversely, if I add new Date in front
(new Date(c.data.Appt.enrolled.start_date))
a date shows up, but it is one day before (April 24, 2018).
In addition to that, when I try to insert the "new Date" version into a function (even though it isn't the correct date), I get a warning in the console saying "Moment construction falls back to js Date. This is discouraged and will be removed in an upcoming major release."
Can someone explain how I should format the dates so I: 1) get the correct date and not one day prior and 2) am able to plug it into a function without getting that warning?
Thanks!
Since the date is a string with no time zone information (just the date) JavaScript Date parser will treat it as universal(UTC, which is in Greenwich Mean Time) time at 00:00 hours. Then it will subtract the offset of your locale's timezone in hours, and will result in the date being a few hours before or after the day you actually want. This is a common point of confusion.
The best way to solve this is to parse the date manually:
function localDate(dateString) {
var d = dateString.split(/\D/);
return new Date(d[0], d[1]-1, d[2]);
}
See this question for more information: Javascript: parse a string to Date as LOCAL time zone
Moment.js gives that warning because it's considered bad practice to rely on the string parsing that new Date() does since it will have different results in different browsers (IE\Firefox\Etc.). It's more cross-browser friendly to build the date using this form: new Date(year, month, day). (Note that the month starts at zero, not 1)

How to set min or max date limit in CakePHP form?

In my current date form input, I have the parameter:
'maxYear' => date('Y')
This lets me limit the max year to this year, but I also need to limit the date selection so users cannot select a date in the future. Using maxYear only allows limiting the year, but I also need months and days.
That's not something you can do with the Form Helper (or the HTML form options even if you'd wrote them manually).
The problem:
If you limit the month to say, 1-7 (if we're currently in July), the user would be unable to select the previous year of any of those months.
The solution:
Use JavaScript onchange validation. When the field(s) change date, check the selected date against your required date range, and give notification if it fails. (see jQuery's .change() documentation if you're using jQuery)
(Then verify on the back-end, as well of course, as JavaScript can easily be manipulated)

Resources