Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: Bulk Delete Schedule Tasks in Orchestrator

$
0
0

I have to say, I am really starting to dislike Dates in code.  I wish the source code always used the same date format.

 

So herein the issue.  When I change the date comparison to below (actually had this in the past) the issue comes with the date format:

new Date() = Thu Nov 05 2015 19:57:10 GMT-0500 (EST)

task.exectionDate = 2015-11-02 22:45:00.0

These are never less-than or greater than in the results.

 

(task.executionDate < pastDate):

[2015-11-08 19:57:10.311] [I] ===========================LOG-BEGIN=======================
[2015-11-08 19:57:10.311] [I] Today's date: Sun Nov 08 2015 19:57:10 GMT-0500 (EST)
[2015-11-08 19:57:10.311] [I] Past date: Thu Nov 05 2015 19:57:10 GMT-0500 (EST)
[2015-11-08 19:57:10.311] [I] Past date in GMT: Fri, 06 Nov 2015 00:57:10 GMT
[2015-11-08 19:57:10.311] [I] ===========================LOG-END=========================
[2015-11-08 19:57:10.379] [I] Task name: TNG_createSnapshot
[2015-11-08 19:57:10.379] [I] STATE: finished Execute date: 2015-11-02 22:45:00.0
[2015-11-08 19:57:10.379] [I] Task TNG_createSnapshot's records will be kept, for now
[2015-11-08 19:57:10.379] [I] Task name: TNG_RemoveSnapshotByName
[2015-11-08 19:57:10.379] [I] STATE: finished Execute date: 2015-11-05 22:45:00.0
[2015-11-08 19:57:10.379] [I] Task TNG_RemoveSnapshotByName's records will be kept, for now

 

(task.executionDate > pastDate):

2015-11-08 20:05:12.895] [I] ===========================LOG-BEGIN=======================
[2015-11-08 20:05:12.895] [I] Today's date: Sun Nov 08 2015 20:05:12 GMT-0500 (EST)
[2015-11-08 20:05:12.895] [I] Past date: Thu Nov 05 2015 20:05:12 GMT-0500 (EST)
[2015-11-08 20:05:12.895] [I] Past date in GMT: Fri, 06 Nov 2015 01:05:12 GMT
[2015-11-08 20:05:12.896] [I] ===========================LOG-END=========================
[2015-11-08 20:05:12.969] [I] Task name: TNG_createSnapshot
[2015-11-08 20:05:12.969] [I] STATE: finished Execute date: 2015-11-02 22:45:00.0
[2015-11-08 20:05:12.969] [I] Task TNG_createSnapshot's records will be kept, for now
[2015-11-08 20:05:12.969] [I] Task name: TNG_RemoveSnapshotByName
[2015-11-08 20:05:12.969] [I] STATE: finished Execute date: 2015-11-05 22:45:00.0
[2015-11-08 20:05:12.970] [I] Task TNG_RemoveSnapshotByName's records will be kept, for now

 

One of these should be marked for deletion.  So my guess/assumption is the system cannot compare these dates as they are in different formats (why I converted them to GMT but did not pay attention they also get converted to a string).

 

So the next thing I tried was to Date.parse (which should return a date) the dates to get them into something common.

The pastDate (Date.parse(pastDate) = Past date: 1446772615000

 

When I do something similar to task.executionDate (Date.parse(task.executionDate)) = Execute date: NaN  [Not-a-number].

I also tried (Date.UTC(task.executionDate)) = Execute date: NaN

 

My (uneducated) guess is the return of task.executionDate is not actually a date or am I just missing something obvious?

Thanks

B


Viewing all articles
Browse latest Browse all 168455

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>