Current File : /home/inlingua/www/crm/ninexb/wp-content/plugins/tablesome/src/table/src/wrapper/date-fns.js
import{isValid,isToday,isYesterday,isTomorrow,differenceInDays,isThisMonth,isThisYear,getTime,getMonth,getYear,format,formatISO,formatRelative,formatDistance,isSameDay,startOfDay,add,addMinutes,sub,startOfMonth,endOfMonth,startOfYear,endOfYear}from"date-fns";const{fromZonedTime,toZonedTime,getTimezoneOffset}=require("date-fns-tz");export function zonedTimeToUtcWrapper(e,t){let o=-1*tablesome_getTimezoneOffset(t,e);tablesome_format(e,"yyyy-MM-dd hh:mm",{},t);return e+o}export function zonedTimeToUtcWrapperStable(e,t){tablesome_format(e,"yyyy-MM-dd hh:mm",{},t);let o=zonedTimeToUtc(e,t);return getTime(o)}export function utcToZonedTimestamp(e,t){return e=toZonedTime(e,t),getTime(e)}export function tablesome_isValid(e){return isValid(e)}export function tablesome_isToday(e){return isToday(e)}export function tablesome_isYesterday(e){return isYesterday(e)}export function tablesome_isTomorrow(e){return isTomorrow(e)}export function tablesome_differenceInDays(e,t){return differenceInDays(e,t)}export function tablesome_isThisMonth(e){return isThisMonth(e)}export function tablesome_isThisYear(e){return isThisYear(e)}export function tablesome_getTimezoneOffset(e,t){return getTimezoneOffset(e,t)}export function tablesome_format(e,t,o,r="local"){return"utc"==r&&(o={timeZone:"UTC"},e=toZonedTime(e,"UTC")),"local"!=r&&"utc"!=r&&(e=toZonedTime(e,r)),format(e,t,o)}export function tablesome_formatISO(e,t){return formatISO(e,t)}export function tablesome_formatRelative(e,t,o){return formatRelative(e,t,o)}export function tablesome_formatDistance(e,t,o){return formatDistance(e,t,o)}export function tablesome_getTime(e){return getTime(e)}export function tablesome_getMonth(e){return getMonth(e)}export function tablesome_getYear(e){return getYear(e)}export function tablesome_isSameDay(e,t){return isSameDay(e,t)}export function tablesome_startOfDay(e){return startOfDay(e)}export function tablesome_add(e,t){return add(e,t)}export function tablesome_addMinutes(e,t){return addMinutes(e,t)}export function tablesome_subtract(e,t){return sub(e,t)}export function tablesome_startOfMonth(e){return startOfMonth(e)}export function tablesome_endOfMonth(e){return endOfMonth(e)}export function tablesome_startOfYear(e){return startOfYear(e)}export function tablesome_endOfYear(e){return endOfYear(e)}export function tablesome_PHPDate(){return(new Date).toISOString().slice(0,19).replace("T"," ")}