![]() It's the date before or the date after the expected date that COULD fall on Sunday that will have to be pushed to Saturday. To reiterate, NONE of the expected dates will ever fall on Sunday. ![]() They really demonstrate the problem very well. Well, I did provide examples in the attached files. Until you can provide more detailed and specific requirements, or at least a few sets of sample input and expected outputs, I'm not really sure what problem I'm trying to solve with JavaScript code. When you say, "UNLESS any fall on Sunday," exactly what is supposed to happen if any of the dates DO fall on a Sunday? For instance, if the "preferred date" is on a Sunday, does the "middle" date (DEL_DATE) get pushed to a Saturday, or to a Monday, or what? And does that mean that the other dates are still "plus one" and "minus one" in relation to that? If the "preferred date" is on a Monday, is the "minus one" date supposed to be pushed back to Saturday, or should the entire range be pushed forward to Monday, Tuesday, and Wednesday? I'm not sure I understand the requirements completely. If (FormatDate(myDate, "ld") = "Sunday")īasically, all delivery days for the form are:Ĭould you possibly take a peek and see where I am going wrong? Well, this is getting bit off the topic of the FormatDate function and into general Date object handling, but you can just add some logic like this: I don't want to return the text "Saturday", I need to return a true date and apply the FormatDate function, read that to see if it will be a Sunday and If so use a (-2) in the calculation instead of a (-1). If the result of the date is Monday and Monday - 1 day will yield Sunday, I need to produce Saturday. I have field "date" that I have to print it, the day before it and the day after it on the same form. JS Graphics JS Graphics JS Canvas JS Plotly JS Chart.js JS Google Chart JS D3.Another date issue to solve. JS vs jQuery jQuery Selectors jQuery HTML jQuery CSS jQuery DOM JS JSON JSON Intro JSON Syntax JSON vs XML JSON Data Types JSON Parse JSON Stringify JSON Objects JSON Arrays JSON Server JSON PHP JSON HTML JSON JSONP ![]() JS AJAX AJAX Intro AJAX XMLHttp AJAX Request AJAX Response AJAX XML File AJAX PHP AJAX ASP AJAX Database AJAX Applications AJAX Examples JS Web APIs Web API Intro Web Forms API Web History API Web Storage API Web Worker API Web Fetch API Web Geolocation API JS Browser BOM JS Window JS Screen JS Location JS History JS Navigator JS Popup Alert JS Timing JS Cookies JS HTML DOM DOM Intro DOM Methods DOM Document DOM Elements DOM HTML DOM Forms DOM CSS DOM Animations DOM Events DOM Event Listener DOM Navigation DOM Nodes DOM Collections DOM Node Lists JS Async JS Callbacks JS Asynchronous JS Promises JS Async/Await JS Classes Class Intro Class Inheritance Class Static JS Functions Function Definitions Function Parameters Function Invocation Function Call Function Apply Function Bind Function Closures JS Objects Object Definitions Object Properties Object Methods Object Display Object Accessors Object Constructors Object Prototypes Object Iterables Object Sets Object Maps Object Reference When one parameter is passed to the Date () constructor, Date instances are specially treated. 1 I work with MomentJs, so if you have a solution with this that can help me, is. This is equivalent to new Date (dateObject.valueOf ()), except the valueOf () method is not called. Im trying to get a conditional what with the date of tomorrow example let me know what if is tomorrow and is more than 1pm of tomorrow so do something. This effectively makes a copy of the existing Date object with the same date and time. JS Tutorial JS HOME JS Introduction JS Where To JS Output JS Statements JS Syntax JS Comments JS Variables JS Let JS Const JS Operators JS Arithmetic JS Assignment JS Data Types JS Functions JS Objects JS Events JS Strings JS String Methods JS String Search JS String Templates JS Numbers JS BigInt JS Number Methods JS Number Properties JS Arrays JS Array Methods JS Array Sort JS Array Iteration JS Array Const JS Dates JS Date Formats JS Date Get Methods JS Date Set Methods JS Math JS Random JS Booleans JS Comparisons JS If Else JS Switch JS Loop For JS Loop For In JS Loop For Of JS Loop While JS Break JS Iterables JS Sets JS Maps JS Typeof JS Type Conversion JS Bitwise JS RegExp JS Precedence JS Errors JS Scope JS Hoisting JS Strict Mode JS this Keyword JS Arrow Function JS Classes JS Modules JS JSON JS Debugging JS Style Guide JS Best Practices JS Mistakes JS Performance JS Reserved Words const date new Date() tDate(date.getDate() + 1) // console.log(date.toLocaleDateString()) //. Date object dateObject An existing Date object.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |