This Gist was automatically created by Carbide, a free online programming environment.
Last active
January 7, 2019 16:41
-
-
Save carbide-public/8b6c5f80a04d98ebdb67c27b70a68089 to your computer and use it in GitHub Desktop.
untitled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moment from 'moment-timezone'; | |
import verifyVisitionTime from './verifyVisitionTime'; | |
const now = moment(); // now, for the local timezone. But you can change that with now.tz('Asia/Tokyo'); | |
const deliveryTime = moment("2019-01-07T14:00:00-05:00"); | |
const verified = verifyVisitionTime(deliveryTime, visitionTime); | |
const slowDeliveryTime = verifyVisitionTime(deliveryTime, visitionTime, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const msPerSec = 1000; | |
export const secPerMin = 60; | |
export const minPerHour = 60; | |
export const toHours = (ms) => ms / msPerSec / sPerMin / minPerHour; | |
export default toHours; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import msToHours from './toHours'; | |
export const verifyVisitationTime = ( deliveryDate, visitationTime, minBusinessHrsForDelivery = 3 ) => { | |
const formatted = deliveryTime.format(); | |
const diff = deliveryTime - visitionTime; | |
}; | |
export default verifyVisitionTime; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment