util.ts 588 B

1234567891011121314151617181920212223
  1. export const formatTime = (date: Date) => {
  2. const year = date.getFullYear()
  3. const month = date.getMonth() + 1
  4. const day = date.getDate()
  5. const hour = date.getHours()
  6. const minute = date.getMinutes()
  7. const second = date.getSeconds()
  8. return (
  9. [year, month, day].map(formatNumber).join('-') +
  10. ' ' +
  11. [hour, minute].map(formatNumber).join(':')
  12. )
  13. }
  14. const formatNumber = (n: number) => {
  15. const s = n.toString()
  16. return s[1] ? s : '0' + s
  17. }
  18. // export const API_BASE_URL = 'http://192.168.0.135:8015/'
  19. export const API_BASE_URL = 'http://project.4dage.com:8015/'