All MODX *publishedon dates showing same date despite different inputs - modx

I am using:
[[*publishedon:strtotime:date=`%e %B %Y`]]
This shows a date (18 August 2015 for some reason) but it won't change. No matter what date I put into the Published On field this will not change.
I have tried reinstalling MODX to no affect.
Would anyone know how to fix this?

It should work that way, if you want to access the publishedon field of the current resource.
If you want to access the publishedon field of resources listed with a getResources template chunk, you have to use
[[+publishedon:strtotime:date=`%e %B %Y`]]

I could be wrong, but have always thought that you can't enter a date into the Published On field; it takes its value from the Publish checkbox. Have you looked at the database to see what date is actually stored for that resource? And if the value stored in the db does in fact change when you enter a new date in the field...?

Ya, you are right:
publishedOn is just the date when the resource was published or published again.
Use a dateTV for something else instead, or better, use publishedOn as a fall back when the dateTV is not set.

Related

PXFormula and SumCalc not calculating correctly (doubling value of field)

Where does the code that makes a PX Formula work exist? I at first assumed it was a SQL Trigger, but I can't seem to find it there. This is why I ask....
I've added a custom field to the SO, called usrSpeedyTotalExt2. I'm trying to get that to sum the SOLine.CuryLineAmt. I added attributes to the SOLine DAC to append the follwing:
[PXFormula(null, typeof(SumCalc<SOOrderExt.usrSpeedyTotalExt2>))]
This seemed to work, but know I'm fining that the value is consistently twice as high as it should be. I've got a second field that's doing the exact same thing.
What's increasingly odd is that I had the same problem with the field, and I thought I had done something wrong so I deleted the PXFormula, created a new field and then added the PX Formula to populate the new field. As such, there shouldn't be any code populating the old field, but strangely it's populated, so there must b e some business logic that's stuck and somehow still populating it.
Any thoughts on how I track this down?
I believe that I figured out the problem...I think that the code may have been imported and published on more than one company, then published from the proper company to multiple tenants.
My fix was to go to the live company, un-publish all, then go back to the company the customizations live in and publish to the appropriate tenants. It would appear that now I'm only getting the proper totals. IDK how that might have happened, but at least it appears to be fixed.

lightning-formatted-date-time - showing previous date (LWC)

I am using the tag "lightning-formatted-date-time" in my lightning web components with the value "2019-06-02" but it is displaying the previous date.
I am not getting if the value is not a valid one for the tag. Please suggest.
Here is the playground code.
https://developer.salesforce.com/docs/component-library/tools/playground/nLT72mjyV/1/edit
Thank you.
When i run the same playground code, i get displayed the "Jun 02, 2019" date.
It might be a timezone thing. I would check your OS timezone settings. Also i would try to add the attribute time-zone="UTC" to it, to ensure correct formatting.
Also try to read through the documentation you can find here: https://developer.salesforce.com/docs/component-library/bundle/lightning-formatted-date-time/documentation
This is because of current user time zone. Salesforce save datetime in UTC formate and while returning it give in current user time zone formate.

How to get the date of the content initial published date?

In Kentico, is there a way to know the date the content was published for the first time? In the view_cms_tree_joined view there are fields called DocumentLastPublished and DocumentCreatedWhen but the latter is populated when the user save the content initially even if it's not published and the former is updated when the content is republished. Should I look at the workflowversionhistory?
You'd have to look through the workflow history for that document and get the initial publish state. If you don't want to do that (might be pretty messy and lengthy) you could always add a field to the page type for an initial publish date which will allow someone to add that date or default to when it is saved and not allow it to be editable after it is saved by using a macro on the enabled property of that field.

XPages Date field with date picker saves value with 12:00:00 time

I use standard dojo date picker and it works fine. Only problem is that actual value that is saved to the document has always 12:00:00 time part. I assume it probably tries to set 12 AM, but since I'm in Europe (CET time zone) it really means noon.
This is quite annoying when I try to do date/time comparison later.
I found posts how I can strip time part completely, e.g. XPages - save date only in Date field , but it needs extra code in post save and in some cases I can't use post save because of access rights.
I understand that XPages work with Java Date that has no option for date only, but at least it should return just 00:00, not 12:00. When I tried to play with timezone setting on the converter I got even different time values in the field.
I was able to change the behavior using custom renderer and component for the datetimehelper, but it is really an overkill. Standard implementation bypasses used convertor, so just custom converter didn't help.
Is there any way how to force the date field to just return date with 00:00 time part? I don't expect any magic where it would save just dateonly field to the document.
Thanks,
M.
No, it's not trying to set 12am and being affected by timezone, what you're seeing is standard. I think it started with 9.0. I suspect the timing is to avoid impacts from Daylight Savings Time changes.
One option is to call .setAnyTime() on the DateTime object for the field.

Creating Lotus Notes documents with specific created/modified/last accessed dates for testing

I'm currently writing an application that moves Notes documents between databases based on the amount of days that have elapsed from the creation/modified/last accessed dates. I would just like to get ideas on a simple and convenient way to create documents with specific dates, without having to change the time on the Domino server, so that I could test out my application.
The best way I found so far was to create a local replica and change the system clock to the date I want. Unfortunately there are problems associated with this method. It does not work on the modified date - I'm not sure how it is getting the modified date information when the location is set to Island (Disconnected) - and it also changes the modified and last accessed dates when the documents are replicated to the server replica.
Someone suggested trying to create a DXL of the document, modify the date time in the DXL file, then import it back into the database as a Notes document; but that does not work. It just takes on the date-time that it was created.
Can anyone offer any other suggestions?
You can set the created date for a document by setting the UNID (which is fundamentally a struct of timestamps, although the actual implementation has changed in recent versions). Accessed and modified times, though, would be unsettable from within the Notes/Domino environment, since the changes you make would be overwritten by the process of saving the changes. If you have a flair for adventure and a need to run with scissors, you could make the changes in the database file itself either programmatically from an external application, or manually with a hex editor. (Editing the binary will work -- folks have been using hex editors to clear the "hide design" flag safely for years. Keep in mind that signed docs will blow up badly, and that you need to ensure that local encryption is off for the database file.)
There's actually a very simple way to spoof the creation date/time: just add a field called $Created with whatever date/time you want. This is alluded to in the Notes C API header file nsfdata.h:
Time/dates associated with notes:
OID.Note Can be Timedate when the note was created
(but not guaranteed to be - look for $CREATED
item first for note creation time)
Obtained by NSFNoteGetInfo(_NOTE_OID) or
OID in SEARCH_MATCH.
Unfortunately, there's no analogous technique for spoofing the mod or access dates. At least none that's ever been documented, as far as I know.
I imagine given how dependent Lotus Notes is on timestamps (for replication, mainly), there isn't an API call that allows you to change the modified, created, or last access dates of a note. (More on the internals of Lotus Notes can be found here.)
I dug around the Notes C API documentation, and found only one mention on how to get/set information in the note's header, including the modified date. However, the documentation states that when you try to update that note (i.e. write it to disk), the last modified date will be overwritten with the date/time it is written to disk.
As an alternative, I would suggest creating your own set of date items within the documents that only you control, for example MyCreated, MyModified, and MyAccessed, and reference those in your code that moves documents based on dates. You would then be able to change these dates as easily as changing any other document item (via agents, forms, etc.)
For MyCreated, create a hidden calculated form field with the formula of #CREATED or #NOW. Set the type to computed when composed.
For MyModified, create a hidden calculated form field with the formula #NOW, and set the type to computed.
MyAccessed gets a bit tricky. If you can do without it, I suggest you live work with just the MyCreated and MyModified. If you need it, you should be able to manage it by setting a field value within the QueryOpen or PostOpen events. Problems occur if your users have only read access to a document - the code to update the MyAccessed field won't be able to store that value.
Hope this helps!

Resources