Timestamp redquerybuilder - redquerybuilder

Timestamp is not working RedQueryBuilder
.getting error unknown datatype
Object { e: "Could not find type 'timestamp'", "__gwt$backingJsError": Error }
​
"__gwt$backingJsError": Error: Could not find type 'timestamp'

Have you defined the "timestamp" data type in your meta data?
I'm the original author of RedQueryBuilder and I'm sad to say I think it is pretty much dead.
Cheers
Sam

Related

Error setDate must implement interface DateTimeInterface symfony fixtures

I search in stackoverflow but i didn't find the answer.
I have this error :
Argument 1 passed to App\Entity\Matchs::setDate() must implement interface DateTimeInterface, bool given,
I have this in my fixtures :
$match1 = new Matchs();
$m1->setDescription('Description ')
->setDate(\DateTime::createFromFormat('d-m-Y hh:mm', '25-12-2001 20:30'))
$manager->persist($m1);
So I don't understand why it does not work because I have implemented the DateTimeInterface interface...
Thansk for help
The DateTime::createFromFormat failed do create a DateTime, and in this case return false.
I belive that problem is the format, instead 'd-m-Y hh:mm' try 'd-m-Y H:i'
You can see a complete list of you can use in the format here https://www.php.net/manual/en/datetime.format.php.

TypeORM: How does TypeORM compare timestamps?

I am using TypeORM to run this query:
SELECT "subagreementlog"."created_at" AS "subagreementlog_created_at" FROM "subagreement_logs" "subagreementlog" WHERE "subagreementlog"."subagreement_id" = $1 AND "subagreementlog"."created_at" > $2 LIMIT 1 -- PARAMETERS: ["0d71866e-3b78-4321-8ae8-dc39ffe82dbc","2020-11-12T13:57:16.618Z"]
I am looking for a record where the "created_at" value is greater than "2020-11-12T13:57:16.618Z" but this is actually returning the same value as if I was saying equal to or greater than.
result is: { subagreementlog_created_at: 2020-11-12T13:57:16.618Z }
Looking for guidance as to why this may be the case.
Also, here is the definition for said field in the Entity
#CreateDateColumn({ name: "created_at" })
#Field(_ => GraphQLISODateTime, {
description: "Timestamp the subagreement was changed"
})
public createdAt!: Date;
Have you tried increasing your parameter value? For example, rather than
2020-11-12T13:57:16.618Z try 2020-11-12T13:57:17.618Z (+1 second)
I believe you will still get a match even though the data is clearly before the parameter.
If you get a match I suspect what is happening is that you are storing data in one timezone (UTC likely) but using a local time for your parameter. I do not know TypeORM but maybe it converts timezones on reads and writes but does not convert parameters.
Just a guess but I hope it helps.

The binary operator GreaterThanOrEqual is not defined for the types 'Microsoft.Exchange.ExchangeSystem.ExDateTime

I'm trying to retrieve events for a user from its Office 365 account using the REST API but filtered by the field "LastModifiedTime". For instance, retrieve all the events that will happen after the date: '2014-09-19T03:45:30.4020439Z' or '2014-09-18T04:05:00Z' but i'm always retrieving this error message:
{
"error": {
"code":"ErrorInternalServerError",
"message":"The binary operator GreaterThanOrEqual is not defined for the types
' Microsoft.Exchange.ExchangeSystem.ExDateTime' and 'System.DateTimeOffset'.",
"innererror":{
"message":"The binary operator GreaterThanOrEqual is not defined for the types
'Microsoft.Exchange.ExchangeSystem.ExDateTime' and 'System.DateTimeOffset'.",
"type":"System.InvalidOperationException",
"stacktrace":" at
System.Linq.Expressions.Expression.GetComparisonOperator(ExpressionType
binaryType, String opName, Expression left, Expression right, Boolean
liftToNull)\r\n at
System.Linq.Expressions.Expression.GreaterThanOrEqual(Expression left,
Expression right, Boolean liftToNull, MethodInfo method)\r\n at
Microsoft.Exchange.Services.OData.Model.DataEntityFilterConverter.ConvertFilterNode(QueryNode queryNode)\r\n at Microsoft.Exchange.Services.OData.Model.DataEntityFilterConverter.
ConvertFilterClause(FilterClause filterClause)\r\n at
Microsoft.Exchange.Services.OData.Model.DataEntityQueryAdpater.GetEntityQueryOptions()\r\n
at Microsoft.Exchange.Services.OData.Model.FindEventsCommand.InternalExecute()\r\n at
Microsoft.Exchange.Services.OData.ODataCommand`2.Execute()\r\n at
Microsoft.Exchange.Services.OData.ODataTask.Execute(TimeSpan
queueAndDelayTime, TimeSpan totalTime)"
}
}
}
And here are urls:
/Me/Events?$select=Subject,Start,End,LastModifiedTime&$filter=LastModifiedTime ge 2014-09-19T03:45:30.4020439Z
/Me/Events?$select=Subject,Start,End,LastModifiedTime&$filter=LastModifiedTime ge 2014-09-18T04:05:00Z
I think my error is caused by the date format but i don't know how to solve it.
Could anybody help me on that, please!
Thank you!
You could try casting your date value to a datetimeoffset similar to below.
/Me/Events?$select=Subject,Start,End,LastModifiedTime&$filter=LastModifiedTime ge datetimeoffset'2014-09-19T03:45:30.4020439Z'
/Me/Events?$select=Subject,Start,End,LastModifiedTime&$filter=LastModifiedTime ge datetimeoffset'2014-09-18T04:05:00Z'
Or You could use the cast operation
/Me/Events?$select=Subject,Start,End,LastModifiedTime&$filter=LastModifiedTime ge cast(2014-09-19T03:45:30.4020439Z, Edm.DateTimeOffset)
/Me/Events?$select=Subject,Start,End,LastModifiedTime&$filter=LastModifiedTime ge cast(2014-09-18T04:05:00Z, Edm.DateTimeOffset)

Form datetime type validation error

I'm using collection form type, where children has datetime type input as single text. But when I submit data in validation fails and getErrorsAsString shows this strange error:
inputDateTime:
ERROR: This value is not valid.
date:
No errors
time:
No errors
Here is how I add my field
//form child
$builder->add('inputDateTime', 'datetime', array(
'date_widget' => 'single_text',
'time_widget' => 'single_text'
));
Why inputDateTime has errors but neither date or time has errors? My locale is set and I tried to add date format but it didn't help.
The "error_bubbling" property of the "date" and the "time" field is set to true, thus errors on those fields bubble up and are attached to the datetime field instead.
You are right that the error message is not very helpful (there's an open ticket for that) but you can debug the problem by printing the $exception variable in the block that catches the TransformationFailedException generated by the DataTransformer (Form.php:611). The exception contains the detailed error description, which is hidden from the end user for security purposes.
In fact it appears that is due to an invalid format date (when you are using a different format which can appears when you have set another timezone or locale for instance). As a result, you juste have to specify the date_format options for the datetime field.
In my case, this solve the issue :
'date_format' => 'dd/MM/yyyy',

How to check is the MediaStore.Audio.Media.ARTIST field empty?

I have been working on a MediaPlayer app, where I use the MediaStore.Audio.Media to get all the songs on the SD card and their title, album, artist, etc. tags. I have a custom adapter where I want to check if the Artist field is empty, so I could set "Artist unknown" for that field. The adapter and the cursor I use are in my opinion irrelevant to this question so I'm not going to paste any code here, since this problem occurs outside the adapter as well.
Here is the problem: when an mp3 song doesn't have an artist tag, the cursor for the artist field (the MediaStore.Audio.Media.ARTIST field) returns "". I have no idea what kind of data type that is (it should be String) because whenever I compare it to a String with the value "", the comparison is false. Even if I assign the return value of that field to a temporary String, and than compare that with the before mentioned "", I still get false. I even tried null, "unknown", "", nothing works.
I've really hit a dead end here and any kind of help would be greatly appreciated.
Thank you in advance, Ivan.
I'm using the very same field (MediaStore.Audio.Media.ARTIST), but what I noticed is different.
When you try to retrieve the song's artist info and currently ther's no info available, what you get is <unknown> string.
I wanted to change that info too and I just went for a:
String artist = (((cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) == null)
|| cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)).equals("")
|| cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)).equals("<unknown>")) ?
"Artist Unknown" : cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)));
the "null and equals.("")" checks should be useless anyway.

Resources