yadfc date range filter with a column with a date format ( momentjs 'lll' ) is not working - yadcf

I have a DataTable with a column for date and time with momentjs format 'lll', the date range filter is not working.
{
column_number : 4,
filter_type: 'range_date',
date_format: 'M d, yyyy',
}

You can try using bootstrap date picker, with the following setup (requires https://github.com/Eonasdan/bootstrap-datetimepicker files)
{
column_number : 4,
filter_type: 'range_date',
datepicker_type: 'bootstrap-datetimepicker',
moment_date_format: 'M d, yyyy',
datepicker_type: 'bootstrap-datetimepicker'
}

Related

Vue date range picker using wrong date

I am using Vue2 Date Range Picker. When I try and pick a date range I either click a start and and end date or I select one of the ranges. In either case it shows the desired input in the fields, however when I click apply the end date changes to another date.
For example, I might click on the last quarter range and it displays 01-04-2022 → 30-06-2022, which is what I want. However when I click apply, it changes to 01-04-2022 → 30-01-2023. I have been pulling my hair out trying to figure out why.
I have the following configuration.
<date-range-picker
v-model="dateRange"
:controlContainerClass="'form-input'"
:locale-data="locale"
:ranges="ranges"
class="picker"
/>
dateRange: {
startDate: null,
endDate: null,
},
ranges: {
'Today': [today, today],
'Yesterday': [yesterday, yesterday],
'This Week': [start_of_week, today],
'Last Week': [start_of_last_week, end_of_last_week],
'This month': [start_of_month, end_of_month],
'Last month': [start_of_last_month, end_of_last_month],
'This Quarter': [start_of_quarter, end_of_quarter],
'Last Quarter': [start_of_last_quarter, end_of_last_quarter],
'This year': [start_of_year, end_of_year],
},
locale: {
direction: 'ltr',
format: 'dd-mm-yyyy',
separator: ' → ',
applyLabel: 'APPLY',
cancelLabel: 'Cancel',
weekLabel: 'W',
customRangeLabel: 'Custom Range',
daysOfWeek: moment.weekdaysMin(),
monthNames: moment.monthsShort(),
firstDay: 1,
autoApply: true,
},

Cannot Properly Transform Unix Timestamp to DateTime in Mule 4

So I am trying to convert a Unix Timestamp into a Human Readable date format (ex: January 20, 2021).
This is the response that I get from an API which gives the Unix timestamp
"time":1388620296020
And then I try to transform it using the Transform Message, my code looks like this
date: (object.properties.time as DateTime) as String {
format: "MMMM dd, yyyy"
},
But the output I get after I deploy it, goes like this
"date": "August 17, +45973"
I am not sure why is it happening.
Epoch can be directly converted to DateTime in Dataweave
Try This
date: (object.properties.time as DateTime {unit : "milliseconds"})
output:
"date": "2014-01-01T23:51:36.02Z"
You can check the output by entering in the below link as well
https://www.unixtimestamp.com/
https://www.epochconverter.com/
Another way to get the exact format,that you mentioned in the quesion (ex: January 20, 2021) it is achievable by below script
%dw 2.0
output application/json
---
date: payload.message as DateTime {unit : "milliseconds"}
as String {format: 'MMMM dd,yyyy'}
this script will give you output as:
{
"date": "January 01,2014"
}
Convert Unix Timestamp to Date Time in Mule 4
Input :
{
"time":1388620296020
}
---------output----------
{
"date": "01-Jan-2014 11:51:36"
}
How to write the script, You understand correct format Date Time.
%dw 2.0
output application/json
{
date: payload.time as DateTime {unit: "milliseconds"} as String {format: 'dd-MMM-yyyy hh:mm:ss'}
}
For more info referred link : https://help.mulesoft.com/s/question/0D52T00004tIkcf/how-to-convert-unix-timestamp-to-normal-human-readable-timestamp-using-dw-20
Thanks

Can Azure Cosmos DB do this kind of query?

I have a JSON object stored in Azure Cosmos DB, and I'm seeing if there's a way to write workable queries doing basic things like Order By.
The structure looks something like :
[
{
"id":"id1",
"title":"test title",
"dataRecord":{
"version":1,
"dataRecordItems":[
{
"itemTitle":"item title 1",
"type":"string",
"value":"My First Title"
},
{
"itemTitle":"item number",
"type":"number",
"value":1
},
{
"itemTitle":"date",
"type":"date",
"value":"21/11/2019 00:00:00"
}
]
}
},
{
"id":"id2",
"title":"test title again",
"dataRecord":{
"version":1,
"dataRecordItems":[
{
"itemTitle":"item title 2",
"type":"string",
"value":"My Second Title"
},
{
"itemTitle":"item number",
"type":"number",
"value":2
},
{
"itemTitle":"date",
"type":"date",
"value":"20/11/2019 00:00:00"
}
]
}
]
I can use ARRAY_CONTAINS to find objects with a particular value, but I run into all kinds of issues if I try to sort by an the value of an object which has the title of "date".
So, as an example, I'd like to be able to say something like (pseudoish code here):
SELECT * FROM c WHERE
ARRAY_CONTAINS(c.dataRecord.dataRecordItems,
{"itemTitle":"item title 2", "value" : "My Second Title"}, true)
AND
ARRAY_CONTAINS(c.dataRecord.dataRecordItems,{"itemTitle":"item number", "value" : 2}, true)
ORDER BY < *** SOMEHOW GET THE DATE HERE from itemTitle = date ***
Then, in this simple case, I would everything returned, but ordered by date.
Obviously in the future I would be pulling out individual fields, but it's all kind of moot if I can't do the first part.
Just wondering if anyone has any great ideas.
Cheers!
You need to store the date in ISO 8601 format:
Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a
second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
where:
YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)
s = one or more digits representing a decimal fraction of a second
TZD = time zone designator (Z or +hh:mm or -hh:mm)
https://www.w3.org/TR/NOTE-datetime

Vue-good-table Invalid Date when date is null using

I'm using a table component for Vuejs called vue-good-table.
It allows you to format your columns with different formats like string, number and date.
My issue today is related to the date formatting. I'm being able to format the column properly, however, some of the values that come from the database are null, and then it appears a label Invalid Date for those rows that have null dates.
Is there a way to configure those columns as nullable or format them in a way that I prevent this message to be shown? I'd rather leave the table cell empty instead of displaying that label.
The following example shows the scenario that I'm describing
<template>
<vue-good-table
:columns="columns"
:globalSearch="true"
:paginate="true"
:rows="rows">
</vue-good-table>
</template>
<script>
export default {
name: 'Table',
computed: {
columns() {
return [{
field:"fieldA",
label:"fieldA",
type:"number"
},{
field:"fieldB",
label:"fieldB",
type:"date",
inputFormat: 'YYYY/MM/DD',
outputFormat: 'YYYY/MM/DD'
}];
}
},
rows() {
return [{
fieldA: 1,
fieldB: null
},{
fieldA: 1,
fieldB: '2017/01/04'
}];
}
}
</script>
In that case, I would have one field with the date formatted correctly, and another field with a label Invalid Date
Thanks
-- UPDATED --
This problem was fixed in most recent versions.
Edit: I have just realized the formatFn function overrides the input and output format options, since it will only use the function to format the data. Not sure if it's the best aproach, but instead you should probably format the data yourself on the function (or format the data before passing to the table). Here's an example using moment:
{
label: 'Date/Time',
field: 'date',
type: 'date',
formatFn: function (value) {
return value != null ? moment(value, 'DD/MM/YYYY HH:mm:ss').format('DD-MM-YYYY HH:mm:ss') : null
}
}
I had the same issue and I was able to format the data using the formatFn function (https://github.com/xaksis/vue-good-table#formatfn-function).
{
label: 'Date/Time',
field: 'date',
type: 'date',
dateInputFormat: 'DD/MM/YYYY HH:mm:ss',
dateOutputFormat: 'DD-MM-YYYY HH:mm:ss',
formatFn: function (value) {
return value != null ? value : null
}
}
Hope this helps

How to disable past dates for date range in Eonasdan bootstrap datetimepicker?

I have to disable past dates in Eonasdan bootstrap datetimepicker v4,
My Code is :
$('input#startDate,input#endDate').datetimepicker({
format: 'DD/MM/YYYY hh:mm:ss',
startDate: new Date()
});
$('#datetimepicker').datetimepicker({
minDate:new Date()
});