Moment.js displaying date incorrectly - ruby

I have a record which reads : date: "2016-02-01 00:00:05. However, when I do moment(date).format("L") the view renders 01/31/2016.
Any idea why? This happens which all dates, always one day before

I found my answer in this post. Auto-answering in case anybody runs into the same issue. As #bschaeffer said, it was a timezone problem, this fixed it:
moment.utc(date).format('L')

Related

how to get current year date and the year count by passing a date in Laravel Carbon?

I'm using Carbon, I expect two functions in my application and I hope those can be done using any Carbon methods. I tried to find it on the internet and could not find an exact answer to my question. So I'm posting it here with the hope someone might help me. Thank you.
what are the functions I expect is:
for example, an event that happened on 2014-05-15
using above date I need to find the event date from current year and how many years for the event now as below,
event from the current year - 2021-05-15
years for the event - 7 years
is there a possible way to do these using any Carbon inbuilt functions?
(I expect this function to a big process in my code and here it's a simple example what should happen)
Use Carbon::diffInYears
$date = Carbon::parse('2021-05-15');
$diffYears = Carbon::now()->diffInYears($date);
Refer Carbon doc for more diff methods https://carbon.nesbot.com/docs/#api-difference

SharePoint - Adding Multiple Arguments With Date Validation

Currently I'm using an argument that doesn't allow new items older than today's date. I would like to change this to have either an and/or argument to only allow dates of today and/or less than three days from today.
Example being; if today is 2/9, allow them to add any dates from 2/9-2/12. Otherwise the validation will give an error for "Out of Range".
Currently I'm using the below code:
=[Appt Time]>TODAY()
I've tried using this as well, but the code is not working. I assume it's due to formatting, or my argument is just totally wrong:
=AND(TODAY()>[Appt Time], [Appt Time]<TODAY()+3)
Thank in advance.
I believe I've cracked it. Wrong formula entered into the validation field: =AND([Appt Time]>TODAY(),[Appt Time]<TODAY()+4)

xp20:add-daytime returning FOTY0001 error message

xp20:add-dayTimeDuration-to-dateTime(string(bpws:getVariableData 
('Eligibility_Out','payload','/ns3:response/ns3:AcctEffDt')), string('P7D'))
I am using the above expression in a BPEL Process to add 7 days to a date which has the format of yyyy-mm-ddT00:00:00+00.
If there is no time element to the date the expression works in the unit tests, but because the data is coming from another application it has this time element. However, there is no time to in the date. Unfortunately, when the expression fails with FOTY0001 error message.
I have not been able to find a solution online and I am asking if anyone can help?
Found the problem. It didn't like finding the value and manipulating the value at the same time. So I broke it into two steps

Today's time in time tag

For date ranges, I currently use this format (until precise specifications come up):
<time datetime="2012-11">November 2012</time> - <time datetime="2013-01">January 2013</time>
I was wondering if there is, or will be, a way to indicate today's date. I mean, I know we can do this:
<time datetime="2013-03-05">Today</time>
but I would like to have something like this:
<time datetime="now">Today</time>
If not, I plan to leave the "Today" word with no extra markup. Would you recommend a better solution?
Thanks!
EDIT: To add bit of context, I am building an online resume, hence the date ranges as well as the ones that involve: <time datetime="yyyy-mm">[Month] [Year]</time> - Present.
Thanks everyone for your efforts.
Just to clarify things, I was not looking for ways to dynamically update the content of the datetime attribute. I just wanted to know if there was a way to semantically indicate the "present" day or time.
The answer is: no, there is no way to do that.
I do believe that there might be a change someday. Some of you wondered when this could be useful. I agree that currently there is no need for that, but there might be ways to indicate date ranges in the future specs (the <time> element is still in draft, after all). If so, there could be ranges that start at a precise point and that are still going, giving a use case for a "present"/"now"/... keyword, IMO.
Try using php or JavaScript to get the local time from the user's computer, then output that as text. See http://php.net/manual/en/function.localtime.php for instructions on doing it with php.
EDIT: It gets the server time, not the user's time. To get the user's time, you have to use javascript.
surfing the web i found this question, i thought it would be cool to answer since today we have an answer to that.
<time datetime="P4DT4H3M">four days, and three minutes</time>
To better understand you can see here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time

jqGrid recreateForm parameter

I would like to know where is the correct ubication of the following sentence:
jQuery.extend(jQuery.jgrid.edit, {recreateForm: true}).
I found here that setting it, you can solve problems with edition of rows, when you are using custom edittype columns, in respect of these type of fields don't refresh between successive editing records. But I proved it without positive results.
I'm using form editing.
Thanks for your helping.
jQuery.extend(jQuery.jgrid.edit, {recreateForm: true});
is the correct code to change default value of recreateForm to true. You can find in my answer in the forum of http://www.trirand.com other different variation to set recreateForm to true.
If this will not help you, you have probably another problem in your code. You can append your question with the code which can be used to reproduce your problem. I or somebody else could try to solve your problem.

Resources