I am using ReactJs to create DateTime picker. Now my problem is how the date object converts to the moment object.
For example below is the date object, this object just show the value of date object:
Wed Sep 21 2022 00:17 GMT+0800 (Malaysia Time)
How can I convert to the moment object like below sample:
Moment {_isAMomentObject: true, _i: Wed Sep 21 2022 00:27:50 GMT+0800 (Malaysia Time), _isUTC: false, _pf: {…}, _locale: Locale, …}
_d
:
Wed Sep 21 2022 00:17:50 GMT+0800 (Malaysia Time) {}
_i
:
Wed Sep 21 2022 00:27:50 GMT+0800 (Malaysia Time) {}
_isAMomentObject
:
true
_isUTC
:
false
_isValid
:
true
_locale
:
Locale {_calendar: {…}, _longDateFormat: {…}, _invalidDate: 'Invalid date', _dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: ƒ, …}
_pf
:
{empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -2, charsLeftOver: 0, …}
[[Prototype]]
:
Object
I don't want to show the date object like the below picture:
Hope someone can guide me on how to solve this problem. Is possible to solve this? Thanks.
Perhaps you should use the following library: moment.
Here is the link to their website, the documentation is pretty well done.
Link to the site: https://momentjs.com/
I hope it will help you, i use this librairy all the time :)
Related
Anyone know how to find metadata from react-dropzone. Currently out of the box it just shows the following:
path: "DSCF2953.jpg"
lastModified: 1643308695461
lastModifiedDate: Thu Jan 27 2022 10:38:15 GMT-0800 (Pacific Standard Time) {}
name: "DSCF2953.jpg"
size: 1442377
type: "image/jpeg"
It shows nothing about the date created type of camera and on....
Is there a way to get to extra file data ?
Tracked Properties of Logic Apps
I am trying to track properties in a Logic App workflow. My problem is I need to track some fields coming from HTTP action.
So my output of HTTP action is something like below.
{
"statusCode": 200,
"headers": {
"x-ms-request-id": "asdfsad",
"x-ms-client-request-id": "ASFSDF",
"x-ms-version": "2020-10-02",
"x-ms-creation-time": "Fri, 05 Nov 2021 12:55:54 GMT",
"x-ms-lease-status": "unlocked",
"x-ms-lease-state": "available",
"x-ms-blob-type": "BlockBlob",
"x-ms-server-encrypted": "true",
"Accept-Ranges": "bytes",
"Date": "Wed, 10 Nov 2021 07:52:11 GMT",
"ETag": "\"SDFGSDGF\"",
"Server": "Windows-Azure-Blob/1.0,Microsoft-HTTPAPI/2.0",
"Content-Length": "1996",
"Content-MD5": "co+35ZaNw7Be9sgn6YB7OA==",
"Content-Type": "text/xml",
"Last-Modified": "Wed, 10 Nov 2021 07:52:11 GMT"
},
"body": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Customer xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://company.Schemas\">\r\n <Company xmlns=\"\">\r\n <CompanyCode>dk01</CompanyCode>\r\n <CompanyIdEcom />\r\n <BillTo>\r\n <CustomerNo>4004002</CustomerNo>\r\n <CreditLimit>0</CreditLimit>\r\n <BlockingLevel>0</BlockingLevel>\r\n <CurrencyCode>DKK</CurrencyCode>\r\n <PaymentTerms>N30</PaymentTerms>\r\n <BillToAddress>\r\n <PostalCode>2750</PostalCode>\r\n </BillToAddress>\r\n <SellTo>\r\n <SellToAddress>\r\n <Address>Lautrupbjerg 7 Postbox 99</Address>\r\n <PostalCode>2750</PostalCode>\r\n <CountryCode>DK</CountryCode>\r\n </SellToAddress>\r\n <ShipTo>\r\n <Code>5637147732</Code>\r\n <ShipToAddress>\r\n <Name>Siemens Medical Instr. Pte.Ltd</Name>\r\n <City>Singapore</City>\r\n <PostalCode>139959</PostalCode>\r\n <CountryCode>SG</CountryCode>\r\n </ShipToAddress>\r\n </ShipTo>\r\n <CustomerNo>4004002</CustomerNo>\r\n <Name>GN Audio A/S</Name>\r\n <Searchname>1000-500092,5479</Searchname>\r\n <CurrencyCode>DKK</CurrencyCode>\r\n <PrimaryContactEmail />\r\n <ModeOfDelivery>AIR DHL EX</ModeOfDelivery>\r\n </SellTo>\r\n </BillTo>\r\n </Company>\r\n <IsDelta xmlns=\"\">true</IsDelta>\r\n</Customer>"
}
I am not able to figure out how I can track Customer no from the XML.
outputs('HTTP-GetBlob')?['body'] (..??????.....)
As far as I remember, tracked properties can only reference #triggerBody, current #action()['inputs'] and #action()['outputs'] - nothing else.
In your case, you'd need to configure tracked properties on your HTTP-GetBlob action like this:
#xpath(xml(action()['outputs']['body']), '(//CustomerNo/text())[1]')?[0]
- experiment with xpath and adjust it to your liking.
One of the workarounds that you can try is to convert the XML into JSON then parse it and then use the required parameters accordingly.
Here are the screenshots for your reference
Here is the output
I'm fairly new to Ionic so please bear with me.
I've managed to create a very simple array called Events that has another small array inside it:
$key: "12345566778"
dates: Array(3)
0: Tue Feb 23 2021 00:00:00 GMT+0000 (Greenwich Mean Time) {}
1: Wed Feb 24 2021 00:00:00 GMT+0000 (Greenwich Mean Time) {}
2: Thu Feb 25 2021 00:00:00 GMT+0000 (Greenwich Mean Time) {}
title: "Quality"
startDate: "2021-02-23"
$key: "314351632623"
dates: Array(3)
0: Wed Feb 17 2021 00:00:00 GMT+0000 (Greenwich Mean Time) {}
1: Thu Feb 18 2021 00:00:00 GMT+0000 (Greenwich Mean Time) {}
2: Fri Feb 19 2021 00:00:00 GMT+0000 (Greenwich Mean Time) {}
title: "Equality"
startDate: "2021-02-17"
What I really want to do is display them in an list in the following format:
Quality
- Tue Feb 23 2021
- Wed Feb 24 2021
- Thu Feb 25 2021
Equality
- Wed Feb 17 2021
- Thu Feb 18 2021
- Fri Feb 19 2021
But at the moment I only know how to cycle through the events array with one ngFor, which isn't what I'm wanting to do:
<ion-select-option *ngFor="let event of Events" value="{{event.title}} - {{event.startDate}}">{{event.title}} - {{event.startDate}}</ion-select-option>
Does anyone know how I can achieve this please?
You just need to nest another loop to achieve that. It'd look like this:
<ion-item *ngFor="let event of Events">
<ion-label>{{ event.title }}</ion-label>
<ion-select>
<ion-select-option *ngFor="let eventDate of event.dates" [value]="eventDate">
{{ eventDate | date:'EEE LLL dd yyyy' }}
</ion-select-option>
</ion-select>
</ion-item>
You'd probably need to edit that code based on your specific UI, but the main idea is to have one loop for the events, and another loop for the dates on each event.
Please also notice that I'm using the Angular date pipe to format the eventDate (https://angular.io/api/common/DatePipe)
EDIT:
I'm trying to get all the results sitting within one ion-select, each as an option. Then I was going to make the titles unselectable and the whole thing multiple choice but that's not really important here.
For some reason I assumed you wanted multiple ion-selects but that makes perfect sense.
In that case, you can use <ng-container></ng-container> to create a nested loop without creating an element that will be rendered in the view.
I think something like this should work (I'm editing the code directly in the browser so you may need to fix a few things, but the main idea at least should be clear).
<ion-item>
<ion-label>Options</ion-label>
<ion-select>
<ng-container *ngFor="let event of Events">
<!-- Title -->
<ion-select-option disabled="true">
{{ event.title }}
</ion-select-option>
<!-- Options -->
<ion-select-option *ngFor="let eventDate of event.dates" [value]="eventDate">
{{ eventDate | date:'EEE LLL dd yyyy' }}
</ion-select-option>
</ng-container>
</ion-select>
</ion-item>
i'm using a React component called DateRangePicker (DRP), so when i choose a date an update my state and console log it, it shows me an object like below,
CheckIn: F
_d: Fri Aug 21 2020 12:00:00 GMT+0430 (Iran Daylight Time) {}
_isAMomentObject: true
_isUTC: false
_isValid: true
_jDiff: 0
_locale: Locale {_calendar: {…}, _longDateFormat: {…}, _invalidDate: "Invalid date", _ordinal: "%dم", _dayOfMonthOrdinalParse: /\d{1,2}/, …}
_pf: {empty: false, unusedTokens: Array(0), unusedInput: Array(0), overflow: -2, charsLeftOver: 0, …}
__proto__: Moment
but i want to extract the date i chose from it, so how can i accomplish this?
Ciao, you see this because the return value of DateRangePicker is a moment object (_isAMomentObject: true). If you want a date in a certain format you could do:
(supposing that value returned is called value)
value.format('YYYY-MM-DD'); //format YYYY-MM-DD
I am using the "insert" API to add a message to Gmail, and using the query parameter internalDateSource=dateHeader. However Gmail seems to ignore the "Date" header that is in my RFC822 data, just substituting the current date. My POST url looks like this:
https://www.googleapis.com/gmail/v1/users/user#gmail.com/messages?uploadType=multipart&internalDateSource=dateHeader&access_token=XYZ
My uploaded data looks like this:
{
"labelIds": [ "Label_96" ],
"raw": "RnJvbTo...tDQr_"
}
There is no doubt that the correct "Date" header is in the encoded raw
data. (Here is an example):
Date: Wed, 1 Oct 2011 10:47:00 -08:00
Google picks up all the other headers and message data correctly. What am I doing wrong? BTW I did try adding "payload" and "headers" to my json in an attempt to specify a Date header. No change.
You have a typo in your Date-header. It should be:
Date: Wed, 1 Oct 2011 10:47:00 -0800
not
Date: Wed, 1 Oct 2011 10:47:00 -08:00