- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 08:12 PM
So far we have confirmed that the following values can be entered and saved
minimum:0001-01-01
maximum:9999-12-31
But the picker is not working properly.
Could you please provide me with the correct information?
Solved! Go to Solution.
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 11:56 PM
GlideDateTime and GlideDate both support earlier dates so if the dates were manually entered, it would be saved. However, if the user opens the DatePicker, it will change the date to the current date and the date must be manually entered again.
Example:
Field "Date" is of type Date. I'm able to save dates "0001-01-01" and "9999-12-31" into the table.
However, if I open DatePicker on the field with value "0001-01-01", it will set it to today instead of "0001-01-01".
If I close the date picker, the date will be set to today so it's necessary to manually enter the date again.
To avoid showing datepicker, set the field type to "Single line text" and add date validation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 08:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 11:01 PM
Hi Hitoshi.
Thanks for the information.
It seems to me to be too narrow in range.
There may well be situations where you enter a date earlier than 1970-01-01
If I enter a date earlier than 1970-01-01, is there any possibility of a problem?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 11:56 PM
GlideDateTime and GlideDate both support earlier dates so if the dates were manually entered, it would be saved. However, if the user opens the DatePicker, it will change the date to the current date and the date must be manually entered again.
Example:
Field "Date" is of type Date. I'm able to save dates "0001-01-01" and "9999-12-31" into the table.
However, if I open DatePicker on the field with value "0001-01-01", it will set it to today instead of "0001-01-01".
If I close the date picker, the date will be set to today so it's necessary to manually enter the date again.
To avoid showing datepicker, set the field type to "Single line text" and add date validation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 12:37 AM
Something like below to validate date.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var isValidDate = validateDate(newValue);
if (!isValidDate) {
g_form.showFieldMsg('u_string_date', 'invalid date', 'error');
}
function validateDate(str) {
try {
var datePattern = g_user_date_format;
datePattern = datePattern.replaceAll('d', '\\d');
datePattern = datePattern.replaceAll('y', '\\d');
datePattern = datePattern.replaceAll('M', '\\d');
datePattern = new RegExp(datePattern);
var isDate = datePattern.test(str);
if (!isDate) {
return false;
}
var nDate = getDateFromFormat(newValue, g_user_date_format);
if (nDate == 0) {
return false;
}
} catch (e) {
return false;
}
return true;
}
}