I am using react-native-calender plugin with bare minimum example. Strangely, Unable to see the dates on left column.
It was expected to look something like this.
Label showing 9 Mon is not coming.
For me, formatting the date to YYYY-MM-DD solves the problem.
const items = {
'2022-10-04': [
{
"key": "200008",
"value": "200040",
}
],
'2022-10-06': [
{
"key": "200008",
"value": "200040",
}
]
}
Related
I'm looking at the Microsoft RulesEngine. This appears to have what I'm looking for but I'm having difficulties getting some of my rules to execute. I have a need to dynamically set/check date times for the customer's rules. I can do this in code and pass it into the ruleset, but I want to eliminate the need to recompile my app to send input values should they decide to change their rules. Having everything in my json file is the optimal solution here. I can then modify the rules, resend a json and call it done.
Here's the scenario: If a person has a license and they are renewing between certain dates then they should get a specific cost. Yes, it's a bit contrived but it's what I need to meet the acceptance criteria. The following doesn't work. Any recommendations/pointers? Thank you in advance!
Here's the sample:
[
{
"WorkflowName": "WithinRenewalPeriod",
"GlobalParams": [
{
"Name": "Last_December",
"Expression": "new DateTime(DateTime.Now.Year - 1 , 12, 1)"
},
{
"Name": "Current_March",
"Expression": "new DateTime(DateTime.Now.Year, 3, 1)"
},
{
"Name": "Current_July",
"Expression": "new DateTime(DateTime.Now.Year, 7, 10)"
}
],
"Rules": [
{
"RuleName": "PriorLicense_Between_Dec1_Mar1",
"Enabled": true,
"ErrorType": 0,
"RuleExpressionType": 0,
"Expression": "person.HistoricalLicenseList.Count() > 0 AND (DateTime.Now >= Last_December AND DateTime.Now <= Current_March)",
"SuccessEvent": "1"
},
{
"RuleName": "HasPriorLicense_Between_Mar2_July10",
"Enabled": true,
"ErrorType": 0,
"RuleExpressionType": 0,
"Expression": "person.HistoricalLicenseList.Count() > 0 AND (DateTime.Now >= Current_March AND DateTime.Now <= Current_July)",
"SuccessEvent": "3000"
}
]
}
]
I figured it out. I was assuming that you would need to "new" the DateTime. This wasn't the case. I ended up removing the "new" keyword and was able to get the GlobalParams to work:
This is wrong:
This is the correct way to instantiate "new" DateTime in GlobalParams:
The end results generated as Inputs:
I would like to ask for help. I have file with custom format. Each line looks similair to this:
T S 123456 0 0.3 -0.9 -0.2 V paramName
Records are separated by tabs (\t)
Basically, i only want to highlight, lets say each word (column, because there will be a lot of those lines) by diferent style/color - it does not matter. I read a lot about custom grammars for VS Code, but I still does not have any idea, how to do it.
One of my attempts:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Testlist for DataExpress",
"patterns": [
{
"include": "#records"
},
{
"include": "#keywords"
}
],
"repository": {
"keywords": {
"patterns": [{
"name": "keyword.control.tsv",
"match": "\\b(TSTLST|Program|Device|Comment)\\b"
}]
},
"records":{
"match": "T\tS\t[0-9]+\t[0-9]+\t[0-9]+.[0-9]+\t[+-][0-9]+.[0-9]+\t[+-][0-9]+.[0-9]+\t.*\t.*",
"captures": {
"1": {
"name":"keyword.operator.new"
},
"2": {
"name":"markup.bold"
},
"3": {
"name":"variable"
},
"4": {
"name":"entity.name.class"
}
}
}
},
"scopeName": "source.tsv"
}
Idea behind was, get back list defined by regexp and then each capture format in different way.
I know, thats a silly idea, but as I said, i am out of ideas for now.
Thanks a lot
Edit
From comment:
Correct regexp is :
(T\tS\t)([0-9]+\t[0-9]+)(\t[0-9]+.[0-9]+)(\t[+-][0-9]+.[0-9]+\t[+-][0-9]+.[0-9]+)(\t.*)(\t.*)
I've been trying to make use of the Google Calendar API. It uses RFC3339 timestamps, for that matter I've tried to modify the provided example 2011-06-03T10:00:00-07:00.
Right now, I'm trying to fetch the events between two dates I've modified manually (maybe there's the error?)
timeMin: 2018-05-26T10:00:00-07:00
timeMax: 2018-06-03T10:00:00-07:00
However, the events are not even within the date range, for example, this is the start date of one of the objects returned
"start": {
"dateTime": "2018-04-30T18:00:00-04:00",
"timeZone": "America/New_York"
},
"end": {
"dateTime": "2018-04-30T19:00:00-04:00",
"timeZone": "America/New_York"
},
Why is this happening? there are even some events from 2017.
Your calendar is probably in a different timezone. Your current returning timestamp indicates -4:00 timezone, and you originally set the event in -7:00.
Modify it to look like this:
{
"end": {
"dateTime": "2012-07-12T10:30:00.0z"
},
"start": {
"dateTime": "2012-07-12T09:30:00.0z"
}
}
This will set Pacific Standart Time.
So, I have a model with a property of type date, let's say it's:
"start_date": {
"type": "date",
"required": true
}
when I get the information from this model, I would like to order by Year of that date
so instead of doing
{
"order": [
"start_date ASC"
]
}
I would like something like
{
"order": [
"dateYear(start_date) ASC"
]
}
is this possible?
If to check DataAccessObject._normalize() function (dao.js in loopback-datasource-juggler), loopback do nothing special with order property of a filter and pass the result to a datasource connector.
So, looks like loopback doesn't support it. The only way to get this functionality, it should be supported by your datasource connector.
I'm trying modify syntax highlighting for CSharp language, so I will get syntax highlighting for SQL in C# string. TextMate has support for embeded languages, so this seems possible.
I build on csharp.tmLanguage.json and I would like to be able to enable embeded SQL with special comment before string like
string query = /*SQL*/ $#"SELECT something FROM ..."
Thanks to TextMate's Language Grammars and Introduction to scopes I came up with this JSON rule
"repository": {
"embeded-sql": {
"contentName": "source.sql",
"begin": "/\\*\\s*SQL\\s*\\*/\\s*\\$?#?\"",
"end": "\";",
"patterns": [
{
"include": "source.sql"
}
]
},
...
}
And thanks to VSCode's Themes, Snippets and Colorizers and Running and Debugging Your Extension I was able to test, that this rule works.
But I have one problem, which I'm unable to solve.
My grammar rule works only if signifficant portion of csharp rules are disabled, If I disable all #declarations and #script-top-level, embeded SQL works:
Otherwise, my rule is overridden by csharp rules like
punctuation.definition.comment.cs
string.quoted.double.cs
comment.block
etc.
The problem is, that my rule works on several language elements and the csharp definition wins on targeting these elements.
On which basis are the elements tagged? How to write my rule, so it will win and tag that syntax before other language rules? Is there any algorithm for calculating weight of rules?
Solution
If you cannot hijack comment syntax in csharp, lets us work with comment in SQL. I made a rule enabled by -- SQL comment and I applied this to verbatim string. Now it works but the styles are sometimes mixed with string. Needs some additional improvements, but looks promising.
The rule that proves to work goes like this
"embeded-sql": {
"contentName": "source.sql",
"begin": "--\\s*SQL",
"end": "(?:\\b|^)(?=\"\\s*;)",
"patterns": [
{
"include": "source.sql"
}
]
},
Now I would like to enable Intellisense and error checking in such embedded language.
The rules in the patterns list are matched in order.
Your rule appears like a specialisation of comment, so you can put it just before the comment.block.cs
"comment": {
"patterns": [
{
"contentName": "source.sql",
"begin": "(/\\*\\s*SQL\\s*\\*/)\\s*\\$?#?\"",
"beginCaptures": {
"1": {
"patterns": [
{
"include": "#comment"
}
]
}
},
"end": "\";",
"patterns": [
{
"include": "source.sql"
}
]
},
{
"name": "comment.block.cs",
"begin": "/\\*",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.cs"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.cs"
}
}
},
...
The snapshot is done on a language my which is just a copy of c# json plus your sql embedding.